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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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