BookmarkSubscribeRSS Feed
dan999
Fluorite | Level 6

I'm using SAS 9.1. I want the date in the format 15-OCT-2012. I found a piece of code here that gets the year in a 2 digit format rather than 4 and I don't know how to change it.

proc format;

     picture date9x other='%0d-%b-%0y' (datatype=date);

run;

data _null_;

     call symputx('enddt',put(intnx('month',today(),-2,'end'),date9x.));

run;

%put enddt = &enddt.;

I get 31-DEC-12. I changed the last part to %Y and now I get 31-DEC-20.

How do I get 2012?

2 REPLIES 2
Haikuo
Onyx | Level 15

proc format;

  picture date9x other='%0d-%b-%Y' (datatype=date);

run;

data _null_;

  call symputx('enddt',put(intnx('month',today(),-2,'end'),date9x11.));

run;

%put enddt = &enddt.;

Haikuo

dan999
Fluorite | Level 6

That works. Thanks Haikuo.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4452 views
  • 0 likes
  • 2 in conversation