do while(SubString1 ne '');
counter + find(String2,strip(SubString1))>0;
if counter=2 then leave;
proc print data=want;
format counter counter.;
var counter String1 String2;
You didn't tell us whether the sequence of words is relevant or not.
If it is relevant then some additional logic would be necessary (i.e. you could define in the find function to only search the string beginning from a certain position - later than where you had already a hit).