It's been a few years since the question was first aske. But using SAS 9.4 , this is fairly simple.
DATA DATE4;
FORMAT DT mmddyy10.
N4 mmddyyN4.
D5 mmddyyD5.
S5 mmddyyS5.
P5 mmddyyP5.
DATE5 DATE5.;
DT=TODAY();
N4=DT;
D5=DT;
S5=DT;
P5=DT;
DATE5=DT;
PUT DT=;
PUT N4=;
PUT S5=;
PUT P5=;
PUT DATE5=;
RUN;
That code produces this output in the log:
DT=09/07/2017 N4=0907 S5=09/07 P5=09.07 DATE5=07SEP NOTE: The data set WORK.DATE4 has 1 observations and 6 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds
You could do the same thing with PUT Statements, if you want the values to show up in a character vs. date format.
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.