Search code examples
datecharactersassas-macro

SAS store the character representation on a date in a macro variable


I have a table looking like this

DATE
01FEB2001
02FEB2001
...

After loading this table I create macro-variables like

data _null_;
    set TBL end=eof;    
    call symput('dtBourse'||left(_N_),DATE);
run;

My problem is that the dtBourse1,dtBourse2 macro variables are worth 17433... (their underlying integer value as a date is stored as an integer)

How can I make sure the macro-variable are characters "01FEB2001","02FEB2001"


Solution

  • The easiest way is to use the VVALUE function, which returns the formatted value

    call symput('dtBourse'||left(_N_),vvalue(DATE));