04-06-2016 12:35 PM
I recommend to store just the date as DATE9. value in a macro variable. From there all sorts use uses are possible.
Have a look at the sample code below.
%let cutdt = 01jan2011; * use as date constant ; data want; somedate = "&cutdt"d; format someDate worddate.; run; * a new formatted date value as text; %let newDate = %sysfunc( putn(%sysevalf("&cutdt"d), ddmmyyp10.)); title "Date as of &newDate"; proc print data=want; run;
04-06-2016 12:39 PM
You can do the conversion in a datstep:
%let cutdt = '01jan2011'd ; data _null_; dt=&cutdt; call symput ('date1', put(dt, date9.)); call symput ('date2', put(dt, worddate12.)); run; %put &=date1; %put &=date2;
I believe %SYSFUNC could also be used, bypassing the datastep, but an example doesn't comes to mind.
Hope this helps,