Can you post an example and log that show the error?
In my head, I think this code, without the parentheses, should generate an error:
options mprint;
data test;
set sashelp.class;
run;
data test2;
set sashelp.cars;
run;
%macro resolvema(name=,out=);
data cc_&out;
set test%if &out=1 %then %do;test2%end;;
run;
%mend;
%resolvema(name=Alfred,out=1);
Interestingly, MPRINT shows that the generated code has no space between test and test2, so the code does resolve to set test1test2; which should error.
But due to some oddities in the tokenizer / word scanner, this actually builds separate tokens for test and test2. The log is:
MPRINT(RESOLVEMA): data cc_1;
MPRINT(RESOLVEMA): set testtest2;
MPRINT(RESOLVEMA): run;
NOTE: There were 19 observations read from the data set WORK.TEST.
NOTE: There were 428 observations read from the data set WORK.TEST2.
NOTE: The data set WORK.CC_1 has 447 observations and 19 variables.
... View more