26%macro mf_wordsInStr1andStr2(
31%local count_base count_extr i i2 extr_word base_word match outvar;
32%
if %length(&str1)=0 or %length(&str2)=0 %then %
do;
33 %put base string (str1)= &str1;
34 %put compare string (str2) = &str2;
37%let count_base=%sysfunc(countw(&Str2));
38%let count_extr=%sysfunc(countw(&Str1));
40%
do i=1 %to &count_extr;
41 %let extr_word=%scan(&Str1,&i,%str( ));
43 %
do i2=1 %to &count_base;
44 %let base_word=%scan(&Str2,&i2,%str( ));
45 %
if &extr_word=&base_word %then %let match=1;
47 %
if &match=1 %then %let outvar=&outvar &extr_word;
52%mend mf_wordsInStr1andStr2;