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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 1545 views
  • 0 likes
  • 2 in conversation