So this is my very first DS2 program, just for fun ;-))) Thanks Rick. The algorithm is based on muthia kachirayan's

%let pattern=12345; /*** < << ==== Your pattern ***/
%let len=%eval(%length(&pattern)-1);

proc ds2;
data Test(overwrite=yes label="Have pattern &pattern");
dcl DOUBLE Position having label 'Pattern position' format commax20.;
keep Position;
dcl SMALLINT PatternCheck [0:&len];
dcl SMALLINT chk; retain chk 0;
dcl BIGINT firstPos; retain firstPos;
dcl BIGINT nOcc;

method init();
/*** Let's state the rules ***/
dcl BIGINT pattern;
dcl BIGINT n;
dcl INT i;
pattern= &pattern; n=1E&len;
do i=0 to &len;
PatternCheck[i]= int(pattern/n);
pattern= mod(pattern,n); n= n/10;
end;
end;

method run();
set have;
if PatternCheck[chk]=digit then chk+1; else chk= (PatternCheck[0]=digit);
if chk=%eval(&len+1) then do;
Position= _N_- &len; output; chk=0;
firstPos= coalesce(firstPos,Position); nOcc+1;
end;
end;

method term();
/*** Reporting ***/
put firstPos= nOcc=;
end;

enddata;
run;
quit;