09-08-2015 09:54 PM
I've below macro that is creating 201509 value as numeric. I need it as a character value. Please suggest.
09-08-2015 10:24 PM
Your code is using a DATA step function to write to a macro variable then trying to write the macro variable back to a SAS variable.
Why not just do it directly?
cur = put(intnx('MONTH',today(),0,'b'),yymmn6.);
09-09-2015 03:09 AM
Both of your tips won't work because the macro variable in the cur= assigment will be evaluated (during data step compilation) before it is set with the call symput (during data step execution)
09-09-2015 01:06 PM - edited 09-09-2015 01:07 PM
All macro variables are stored as strings. What behavour (error message etc) are you seeing that makes it numeric.
You can see from this log that if we try to store a numeric in a macro var it is converted to char by SAS.
1 data null; 2 call symput('currmonS',put(date(),yymmn6.)); 3 call symput('currmonN',date()); 4 run; NOTE: Numeric values have been converted to character values at the places given by: (Line) : (Column). 3:28
NOTE: The data set WORK.NULL has 1 observations and 0 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds