Here’s some macro code to put a list of values from a SAS table into a bunch of variables:

%LET CURRENT_TABLE_DATE = ‘APR2009’;

%GLOBAL CURRENT_TABLE_DATE;

%MACRO RUN_DATES;

PROC SQL;

SELECT DISTINCT TABLE_DATE INTO :TABLE_DATE1-:TABLE_DATE100

FROM DATE_LIST;

QUIT;

%DO I=1 %TO 100;

%LET CURR_TABLE_DATE=&&TABLE_DATE&I;

%PUT &I &&TABLE_DATE&I &CURR_TABLE_DATE;

%MY_MACRO_THAT_USES_GLOBAL_VARIABLE;

%END;

%MEND RUN_DATES;

%RUN_DATES;

Leave a Reply

Your email address will not be published. Required fields are marked *