Seems like this should be a very simple task, but I've been searching and I can't find a straight answer.
I have a variable named IMGDate that contains the number of days since Jan 1 1960. For example, 21164 represents Sept 27, 2017.
I want to convert this variable so that 21164 is in 20170927 format.
There are several SAS formats that show dates. My favorite is DATA9., but here is a link to some others.
Just use the FORMAT statement to assign a format to a variable:
data A;
format IMGDate DATE9.;
IMGDate = 21164;
run;
proc print; run;
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!
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.