Tried this but didn't succeed. Then tried to change this part "%let field=%scan(&fields,&i);" to "%let field=%scan(&fields,&j);" - didn't succeed either. However, I got help on my old thread. So I got a solution already 🙂
%macro new_loop(texts, fields=ORIG_NM BENEF_NM SCND_ORIG_NM SCND_BENEF_NM SEND_INSTN_NM); %local i j like_str text; %let texts=%upcase(&texts); %do i=1 %to %sysfunc(countw(&texts)); %let text=%scan(&texts,&i); %let field=%scan(&fields,&i); %let like_str=%unquote(%nrstr(%'%%)&text%nrstr(%%%')); when upper(%scan(&fields,1)) like &like_str %do j=2 %to %sysfunc(countw(&fields)); or upper(%scan(&fields,&j)) like &like_str %end; then %sysfunc(quote(&field,%str(%'))) %put _local_; %end; %mend;
... View more