Untested, but an idea of how to extend @Tom nice clean solution to multiple words.
%let searchWords = apple, banana, pears;
data want ;
set have ;
fname=codename;
nWords = countw("&searchWords");
infile code filevar=fname end=eof;
found=0;
do while (not eof and not found);
input;
do i=1 to nWords while (not found);
str = scan("&searchWords", i, ",");
if find(_infile_, str ,'i') then found=1;
end;
end;
keep codepath found;
run;
... View more