Compare() function compares two strings. Returns left-most position of the byte which is not matching and 0(zero) when the two strings are same. Since you have given only two strings which has a differeing byte at the 15-position and I am adding one more string to show that COMPARE() function returns 0. data a;
length f1 $ 66;
input f1;
datalines;
GAGCAAGCGCCATACTCCTGTGGAGAAGTCTGCCGTTACTGCCCTGTGGGGCAAGGTGAACGTGGA
GAGCAAGCGCCATACTCCTGTGGAGAAGTCTGCCGTTACTGCCCTGTGGGGCAAGGTGAACGTGGA
GAGCAAGCGCCATAGTCCTGTGGAGAAGTCTGCCGTTACTGCCCTGTGGGGCAAGGTGAACGTGGA
;
run;
data _null_;
retain old;
set a;
if _n_ = 1 then old = f1;
else do;
dif = compare(f1, old);
put dif = ;
if dif = 0 then put 'No Difference';
if dif ^= 0 then substr(f1, dif, 1) = lowcase(substr(f1, dif, 1));
put f1 = ;
end;
run;
... View more