Home > Blog > SAS Table Value into variable

SAS Table Value into variable

Posted by admin on June 4, 2013

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;

Comments:

Leave a Reply



(Your email will not be publicly displayed.)

Please type the letters and numbers shown in the image.Captcha Code