Karl is right in that constant text must be quoted, but you my still need to distinguish between incoming data sets. Consider using the INDSNAME= option on the SET statement. Untested code follows: %MACRO STACK(STACKED,FILE1,FILE2) ; DATA B.&STACKED ; SET A.&FILE1 A.&FILE2 indsname=fred; FILE_PERIOD = SUBSTR(fred,7,10) ; RUN; %MEND stacK; %STACK(STACKED_2011DEC31,FILE1_2011DEC31,FILE2_2011DEC31) ; Notice that the variable name FRED is not quoted. I also named the macro on the %MEND - this is just good housekeeping.
... View more