@fsuzhang :
Your looping is wrong, which is why you ABSOLUTELY MUST create example code without macros and without macro variables that works without errors and does what you want, for a small example. Correct code would be, for example with just two months
data test3;
set rec_oct10 rec_nov10;
run;
A DATA step DO loop will not and cannot produce the above code, and a data step DO loop is not needed here.
Note, that looping inside a macro %DO loop, analogous to your code with a DATA step DO loop, with a SET statement inside the loop, is not going to get you the result you want, because this produces many SET statements, and correct code would use a single SET statement.
Based on the above code, a valid SAS macro would put all of the data set names in a single SET statement. So your macro %DO loop must be within a single SET statement.
So given the above, can you now turn the correct code into a valid macro?
... View more