Returns the date for the nth occurrence of a weekday for the specified month and year.
| Category: | Date and Time |
specifies the numeric week of the month that contains the specified day.
| Range | 1–5 |
| Tip | N=5 indicates that the specified day occurs in the last week of that month. Sometimes n=4 and n=5 produce the same results. |
specifies the number that corresponds to the day of the week.
| Range | 1–7 |
| Tip | Sunday is considered the first day of the week and has a weekday value of 1. |
specifies the number that corresponds to the month of the year.
| Range | 1–12 |
specifies a four-digit calendar year.
data _null_;
/* Return the date of the third Monday in May 2000. */
a=nwkdom(3, 2, 5, 2000);
/* Return the date of the fourth Wednesday in November 2007. */
b=nwkdom(4, 4, 11, 2007);
/* Return the date of the fourth Saturday in November 2007. */
c=nwkdom(4, 7, 11, 2007);
/* Return the date of the first Sunday in January 2007. */
d=nwkdom(1, 1, 1, 2007);
/* Return the date of the second Tuesday in September 2007. */
e=nwkdom(2, 3, 9, 2007);
/* Return the date of the fifth Thursday in December 2007. */
f=nwkdom(5, 5, 12, 2007);
put a= weekdatx.;
put b= weekdatx.;
put c= weekdatx.;
put d= weekdatx.;
put e= weekdatx.;
put f= weekdatx.;
run;