I'm using SAS 9.1. I want the date in the format 15-OCT-2012. I found a piece of code here that gets the year in a 2 digit format rather than 4 and I don't know how to change it.
proc format;
picture date9x other='%0d-%b-%0y' (datatype=date);
run;
data _null_;
call symputx('enddt',put(intnx('month',today(),-2,'end'),date9x.));
run;
%put enddt = &enddt.;
I get 31-DEC-12. I changed the last part to %Y and now I get 31-DEC-20.
How do I get 2012?
proc format;
picture date9x other='%0d-%b-%Y' (datatype=date);
run;
data _null_;
call symputx('enddt',put(intnx('month',today(),-2,'end'),date9x11.));
run;
%put enddt = &enddt.;
Haikuo
That works. Thanks Haikuo.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.