BookmarkSubscribeRSS Feed
Alessandra_005
Calcite | Level 5

Hi,

 

How can I transofm the number 201403 into the date 03/2014 on SAS?

 

Thank you 

3 REPLIES 3
SASKiwi
PROC Star

There isn't a SAS format for what you want but you can create your own (untested):

 

proc format;
  picture MyDateFmt low-high='%0m/%y' (datatype=date);
run;

data test;
  datenum = 201403;
  MyDate = input(put(datenum * 100 + 1, 8.), yymmdd8.);
  format MyDate MyDateFmt.;
  put _all_;
run;
slchen
Lapis Lazuli | Level 10

data _null_;
date=201403;
_date=input(put(date,6.),yymmn6.);
format _date mmyys7.;
put _all_;
run;

Cynthia_sas
SAS Super FREQ
Hi:
This post is remarkably similar (uses the same number as this posting https://communities.sas.com/t5/Base-SAS-Programming/Importing-sas7bdat-file/m-p/370282#M88434) 201403 as an example of a number that is a date variable.

Homework?? Another possible answer was posted in the other forum. Also posted with a longer explanation of how date variables work.

cynthia

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