BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Can anyone let me know if there is a date format in SAS that would produce a date as follows:

Wednesday, 30 August 2005

or, should I create my own date format?

Thanks in advance!
5 REPLIES 5
Cynthia_sas
SAS Super FREQ
Try this (in an EG code node -- NOT as a stored process). Probably WEEKDATX is the format you want. The documentation on SAS formats is quite extensive and and overview and list of formats can be found under the topic:
Dates, Times, and Intervals --> About SAS Date, Time, and Datetime Values

in the online documentation.
cynthia
[pre]
data testdates;
infile datalines;
input name $ bday1 : mmddyy10.;
bday2 = bday1;
bday3 = bday1;
bday4 = bday1;
bday5 = bday1;
return;
datalines;
alan 11/15/1950
bob 12/31/1960
carl 11/29/1984
dave 03/03/2003
;
run;

proc print data=testdates label;
var bday1-bday5;
format bday1 WEEKDATX. bday2 WEEKDATX23. bday3 worddatx. bday4 date11.;
label bday1 = 'WEEKDATX'
bday2 = 'WEEKDATX23'
bday3 = 'WORDDATX'
bday4 = 'DATE11'
bday5 = 'unformatted value';
run;

[/pre]
deleted_user
Not applicable
Thanks, Cynthia,

I'll look at the formats.... and do you think ALL of my code is in Stored Processes ? 😉 Just kidding! I really appreciate your guidance on so many items.

Thank you again and again!
Cynthia_sas
SAS Super FREQ
No, but, after the last time I forgot to mention that the code was NOT a stored process, I feel that I ought to qualify code examples with how I intend them to be run.

Glad to help.
cynthia
deleted_user
Not applicable
try this:

data _null_;
x = put("30aug2005"d,weekdatx.);
putlog x;
run;
deleted_user
Not applicable
Thank you, Claude, however, this issue was resolved this past July. I appreciate your trying to help.

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 2017 views
  • 0 likes
  • 2 in conversation