Help using Base SAS procedures

what format to express SAS date like this Jan012012

Accepted Solution Solved
Reply
Regular Contributor
Posts: 222
Accepted Solution

what format to express SAS date like this Jan012012

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


Accepted Solutions
Solution
‎08-07-2012 09:54 AM
PROC Star
Posts: 7,363

Re: what format to express SAS date like this Jan012012

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


All Replies
Valued Guide
Posts: 797

Re: what format to express SAS date like this Jan012012

Solution
‎08-07-2012 09:54 AM
PROC Star
Posts: 7,363

Re: what format to express SAS date like this Jan012012

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

;

Regular Contributor
Posts: 222

Re: what format to express SAS date like this Jan012012

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)));

Super User
Posts: 5,085

Re: what format to express SAS date like this Jan012012

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.

Regular Contributor
Posts: 222

Re: what format to express SAS date like this Jan012012

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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