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;
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →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.