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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.