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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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