BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
paperboy22
Calcite | Level 5

I wanted to double check that 1= Sunday, 2= Monday, etc. because I was able to label the days of the week for the patients' last appointment (i.e. Jane Smith was day 3, Laura Smellner was day 5), but when I used the format weekdate9. to get the actual day it made 3= Monday, 5= Wednesday, etc.

 

DATA scheduling(drop=bdate);
input patient $ 1-17 bdate :mmddyy10. lastappt :mmddyy10.;
Day=weekday(lastappt);
format bdate lastappt mmddyy10. day weekdate9.;
DATALINES;
Jane Smith 10/25/1985 06/15/2010
Laura Smellner 10/20/1947 06/17/2010
Jenna Jones 10/23/1964 07/01/2010
Beth Bonders 10/26/1939 07/14/2010
Grace Johson 10/19/1958 07/29/2010
Mary Contrary 10/22/1981 06/30/2010
Jennifer Palermo 10/21/1953 09/03/2010
Ann Lewis 10/24/1975 08/15/2010
Linda Bentner 10/13/1938 09/04/2010
Francine Scalia 10/14/1963 09/04/2010
Leah Thill 10/15/1949 08/01/2010
Caroline Harris 10/16/1968 08/11/2010
Olivia Knupf 10/17/1972 07/31/2010
Maya Angelson 10/18/1961 07/17/2010
;
RUN;

1 ACCEPTED SOLUTION

Accepted Solutions
muratatik
Obsidian | Level 7

Hi,

 

You use weekday function and it's returns integer that represents day like 1=Sunday 2=Monday etc.

 

Then you format with this day varible with weekdate9.

 

Thats meaning you getting which day of 4 June 1960 when day=3

 

I suggest you directly convert lastappt variable,

 

Day=put(lastappt,weekdate9.) 

 

 

View solution in original post

3 REPLIES 3
LinusH
Tourmaline | Level 20
Sunday is 1.
Data never sleeps
muratatik
Obsidian | Level 7

Hi,

 

You use weekday function and it's returns integer that represents day like 1=Sunday 2=Monday etc.

 

Then you format with this day varible with weekdate9.

 

Thats meaning you getting which day of 4 June 1960 when day=3

 

I suggest you directly convert lastappt variable,

 

Day=put(lastappt,weekdate9.) 

 

 

paperboy22
Calcite | Level 5

Thank you!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 3 replies
  • 1754 views
  • 0 likes
  • 3 in conversation