BookmarkSubscribeRSS Feed
Luke_Wiebolt
Calcite | Level 5

We have a column of dates in a four digit number format currently (9501). We need this recoded to display something resembeling: Jan,1995 but we can't figure out the function or expression to do so. Any suggestions?? Thanks!! version 7.1

5 REPLIES 5
Luke_Wiebolt
Calcite | Level 5

PLEASE HELP!!!

ballardw
Super User

Recommend making and actual date valued variable. Is that value supposed to be YYMM (year and month?) If so do have ANY years with values less than 20 that would indicate 1915 instead of 2015? If so how do you tell the actual year?

 

data junk;
   date= 9501;
   SASdate= mdy( mod(date,100),1,int(date/100));
   Format sasdate MONYY7.;
run;

proc print; run;
Luke_Wiebolt
Calcite | Level 5

Thank you very much! This worked just as we hoped, perfect!

PGStats
Opal | Level 21

Please mark the solution as Accepted.

PG
Patrick
Opal | Level 21

Alternatively there is also an informat which can read such strings.

data sample;
  have=9501;
  want=input(put(have,4.),yymmn4.);
  format want monyy7.;
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 1160 views
  • 2 likes
  • 4 in conversation