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

Hello everyone

I can use %put %sysfunc(date(),monyy7);     to give a date format like  AUG2012,but this doen't include date

what format we can use to express date like  AUG082012??

Thanks

Mike

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

Not sure how you want to use it, but the following achieves the desired result:

data want;

  input term date9.;

  x= compress(put(term,worddate12.)," ,");

  cards;

14jun2012

28feb2011

;

View solution in original post

5 REPLIES 5
mkeintz
PROC Star

See the "formats by category" page: http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001263753.htm

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
art297
Opal | Level 21

Not sure how you want to use it, but the following achieves the desired result:

data want;

  input term date9.;

  x= compress(put(term,worddate12.)," ,");

  cards;

14jun2012

28feb2011

;

Mike_Davis
Fluorite | Level 6

Thanks Art,

1.%put %sysfunc(compress("abc_%sysfunc(date(),worddate12.)"," ,"));

2.%put abc_%sysfunc(date(),Monname3)%sysfunc(strip(%sysfunc(date(),day)))_%sysfunc(strip(%sysfunc(date(),year)));

Astounding
PROC Star

Why wouldn't you just use &SYSDATE9?  It is there for the taking, and wouldn't that be easier to read?

If you really want to rearrange it, you could use:

%let mydate = %substr(&sysdate9,3,3)%substr(&sysdate9,1,2)%substr(&sysdate9,6,4);
%put &mydate;

Good luck.

Mike_Davis
Fluorite | Level 6

I believe &sysdate value is the date of the SAS section opened.not the current time.if the SAS section has opened for a long time,

this value could not express the current date we need.

Thank you

Mike

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 885 views
  • 0 likes
  • 4 in conversation