BookmarkSubscribeRSS Feed
mnew
Calcite | Level 5
Experts:

Another beginner question. Reviewing the weekday function this morning. What is the best way to convert the weekday function result to 'Sunday...' instead of showing 1-7? Every solution I came up with seemed to be too clumsy. One of them was simply a bad idea. I tried to format the weekday result in weekdate3. :-).

Thank you!
5 REPLIES 5
Vasile01
Fluorite | Level 6
Hi,
I am not yet an expert on SAS. Try look on proc format.
Warm regards,
Vasile
data_null__
Jade | Level 19
Did you try weekdate9.?

[pre]
6 data _null_;
7 do date = today() to today()+14;
8 put date weekdate9.;
9 end;
10 run;

Saturday
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
[/pre]
mnew
Calcite | Level 5
Thanks to you both!
My question is not how to format a date value to show the weekday. I was hoping for a shortcut that convert the weekday function results (1-7) to Sun-Sat. Proc Format as Vasile suggested is definitely a solution.
Peter_C
Rhodochrosite | Level 12
have you tried PUT as a function?
Weekday = PUT( date_var, weekdate3. );
mnew
Calcite | Level 5
Great idea. This is the shortcut I was looking for. Thank you.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3393 views
  • 0 likes
  • 4 in conversation