I use macros to repetitively do something (thousands of times).
Code:data _null_; set Word_List(keep=word value); n=_N_; call symput("word"||left(n),word); call symput("value"||left(n),value) call symput("NUMWORDS",n); run; *Check out the macro variables you just defined:; %put _user_; *In the data step we will want to do many IF statements, so set up a macro that will cycle through all the macro variables; %macro wordlistcheck; %let n=1; %do %while (%eval(&n)<=&NUMWORDS); if index(phrase,"&&word&n") then score+&&value&n; %let n=%eval(&n+1); %end; %mend wordlistcheck; *Put the above macro into your data step; data phrase_score; set phrase_list; score=0; %wordlistcheck; if score=0 then delete; run;




Reply With Quote
