Hi All, I love all the solutions here, it shows that how flexible SAS is to accommodate many different approaches to a problem. At first, my program was specific to the sequence 12345 then I modified it into the following macro so any sequence of numbers of any length could be found.

%macro checkseq(seq);
%let seq_n = %length(&seq);
%put &seq is &seq_n digits long;
%do zz=1 %to &seq_n;
%let seq&zz = %substr(&seq,&zz,1);
%end;

data count;
set have;
retain n flag firstrow 0;

chgflag=0;
if digit=&seq1 and flag=0 then do; flag=1; chgflag=1; firstrow=_n_; end;
%do zz=2 %to &seq_n;
else if digit=&&seq&zz and flag=&zz-1 and chgflag=0 then do; flag=&zz; chgflag=1; end;
%end;
if chgflag=0 then flag=0;
if flag=&seq_n then do;
n+1;
call symput('n_seq', compress(put(n,8.)));
if n=1 then call symput('firstrow', compress(put(firstrow,8.)));
end;
run;

%put The sequence &seq appears &n_seq times and the first occurrence starts at row &firstrow..;

%mend;

%checkseq(12345);
%checkseq(654321);