BookmarkSubscribeRSS Feed
PujaDas
Calcite | Level 5
Hi Team,
I am new in sas programming. Can anyone help me to build the logic of the below.
Here the date is assigned as a char And we are getting output in pdf as for example 03/03/2017. Now the requirement is to change the ouput date look to 03-MAR-17.
Please help me out how it is possible to do.

Thsnks,
Puja
3 REPLIES 3
Reeza
Super User

You need to show how you're using the date and we can then show you how to change the format. 

art297
Opal | Level 21

1. Converting a character date to a SAS date: SASDateVariableName=input(yourdatevariable, anydtdte.);

2. Assign the desired format: format ASDateVariableName mmddyyD10.;

 

Other variants of that format can be found at: http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000590662.htm

 

Art, CEO, AnalystFinder.com

 

Astounding
PROC Star

Well, I would never show you have to get a date with a two-digit year.  I hope this is close enough:

 

data want;

length mydate $ 11;

set have;

mydate = put(input(mydate, mmddyy10.), date11.);

run;

 

That's assuming that 03/03/2017 is actually in MMDDYY form, rather than DDMMYY form.

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!

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