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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.