Replace that macro code with data step code, and it will be a lot easier.
First, wrap the ....... code into its own macro:
%macro do_single(part1,part2,var,bins,lm1,lm2,rounding);
........
%mend;
Then restructure your outer macro:
%macro LTV_DSCR(file1,file2,var,bins,lm1,lm2,rounding);
data _null_;
do i = 1 to countw("&file1", ' ');
part1 = scan("&file1",i,' ');
do j = 1 to countw("&file2",' ');
part2 = scan("&file2",j,' ');
call execute('%nrstr(%do_single(' !! trim(part1) !! ',' !! trim(part2) !! ",&var,&bins,&lm1,&lm2,&rounding))");
end;
end;
run;
%mend LTV_DSCR;
For the data step, there is no reason to consider anything in a string a "special word" that needs to be masked.
See this simple example:
%macro do_single(part1,part2,var,bins,lm1,lm2,rounding);
%put &part1;
%put &part2;
%put &rounding;
%mend;
%macro LTV_DSCR(file1,file2,var,bins,lm1,lm2,rounding);
data _null_;
do i = 1 to countw("&file1", ' ');
part1 = scan("&file1",i,' ');
do j = 1 to countw("&file2",' ');
part2 = scan("&file2",j,' ');
call execute('%nrstr(%do_single(' !! trim(part1) !! ',' !! trim(part2) !! ",&var,&bins,&lm1,&lm2,&rounding))");
end;
end;
run;
%mend LTV_DSCR;
%LTV_DSCR(RT OR OF IN MF LO, W SE SW MW NE, LTV, 10, 2.5, 4, 0.1);
Abbreviated log from that:
45 %LTV_DSCR(RT OR OF IN MF LO, W SE SW MW NE, LTV, 10, 2.5, 4, 0.1);
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: CALL EXECUTE generated line.
1 + %do_single(RT,W,LTV,10,2.5,4,0.1)
RT
W
0.1
2 + %do_single(RT,SE,LTV,10,2.5,4,0.1)
RT
SE
0.1
... View more