Hi everyone, I'm trying to use FINDW to find a list of words in string variables. Since I have a long list of words that were originally taken from Excel, I put them all into a macro variable. So far I have the syntax below, but each time I run it, I get an error message. I have a feeling it has to do with the fact some of the words in my list have spaces, parentheses and dashes, but I'm not sure how to account for that in my code. Any help is greatly appreciated! data test;
set data;
if findw(lowcase(var1),&alldrugs, '|','I S') >0 or
findw(lowcase(var2),&alldrugs, '|','I S') >0 or
findw(lowcase(var3),&alldrugs, '|','I S') >0 or
findw(lowcase(var4),&alldrugs, '|','I S') >0 or
findw(lowcase(var5),&alldrugs, '|','I S') >0
then drug='Yes' ;
else drug='No';
run;
... View more