CORE
mf_wordsinstr1butnotstr2.sas
Go to the documentation of this file.
1 
26 %macro mf_wordsInStr1ButNotStr2(
27  Str1= /* string containing words to extract */
28  ,Str2= /* used to compare with the extract string */
29  );
30 
31 %local count_base count_extr i i2 extr_word base_word match outvar;
32 %let count_base=%sysfunc(countw(&Str2));
33 %let count_extr=%sysfunc(countw(&Str1));
34 
35 %do i=1 %to &count_extr;
36  %let extr_word=%scan(&Str1,&i,%str( ));
37  %let match=0;
38  %do i2=1 %to &count_base;
39  %let base_word=%scan(&Str2,&i2,%str( ));
40  %if &extr_word=&base_word %then %let match=1;
41  %end;
42  %if &match=0 %then %let outvar=&outvar &extr_word;
43 %end;
44 
45  &outvar
46 
47 %mend;
48