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

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;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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