BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Wolverine
Pyrite | Level 9

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.

1 ACCEPTED SOLUTION
2 REPLIES 2
Rick_SAS
SAS Super FREQ

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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1652 views
  • 0 likes
  • 3 in conversation