PLEASE post code as text not a picture.
Copy from the editor (or log) and paste into a text box opened on the forum with either of the </> or "running man" icons.
It is much easier to copy/paste and edit for us to make suggestions to code than to retype everything from scratch.
The FIND or INDEX functions will work in a where condition:
%let pattern= AN;
proc print data=sashelp.class;
where find(name,"&pattern.",'i')>0;
run;
Find will return the starting character position number of the 'pattern', or to find value, in the string variable or value as the first argument to the function. the modifier 'i' says to ignore case, which may or may not be desired. If case sensitive then omit the ,'i' bit.