Related to the original question, there is also the %INM macro which may be of use, and is a lot less typing than creating your own macro to find matches in a text string.
%macro inm(slist,s);
/* SAS Macro %inm to see if &s is contained in a string or list &slist */
/* Borrowed from https://groups.google.com/forum/#!topic/comp.soft-sys.sas/fWcSDgg11tE */
%if %sysfunc(indexw(&slist,&s)) gt 0 %then 1 ;
%else 0;
%mend;
The output of the macro is a 1 indicating a match, or a zero indicates no match.
Example of use:
%let countrylist=AU AT CH;
%let thiscountry=AT;
%if %inm(&countrylist,&thiscountry) %then %do;
%put This country is &thiscountry, Match found;
%end;
%let thiscountry=RP;
%if not %inm(&countrylist,&thiscountry) %then %do;
%put This country is &thiscountry, Match not found;
%end;
Sometimes (most times?) asking here in the forum if there is a macro to perform your task is a good first step, rather than just going ahead and trying to write the macro yourself.
... View more