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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1756 views
  • 0 likes
  • 4 in conversation