To what end, what is it you want out at the end. The reason being is that Base SAS is a really powerful language for data manipulation and can do this type of work far better than macro which only generates Base SAS code. You you take this prompt and want to run a macro on all datasets within the given libraries. You could go your way, or you could just say:
data _null_;
do i=1 to countw("&x.",",");
call execute(cats('%domacro (l=f_',put(input(scan("&x.",i,","),best.),z3.),');'));
end;
run;
This will loop over each comma delimited value in &x, and for each one call the macro domacro, with the parameter f_ and the value from the list. Far simpler. Macro is not a replacement for Base SAS!
... View more