- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I want to locate the last sunday of month but I am confused whether the following syntax is correct or not.
or there is any other way to locate it?
last sunday=INTNX ('WEEK', INTNX('MONTH', TODAY() , 0, 'E') , 0 , 'B')
Please if you could help here.
Thanks!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Looks good to me.
You take a date and shift it forward to the last day of the month. Then you shift that last day of the month back to the first day of the week the last day of the month is in. With SAS the first day of the week is Sunday.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Looks good to me.
You take a date and shift it forward to the last day of the month. Then you shift that last day of the month back to the first day of the week the last day of the month is in. With SAS the first day of the week is Sunday.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank alot
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Or try another function : NWKDOM(n, weekday, month, year)
last_sunday=nwkdom( 5 , 1, 2 , 2020) ;
-- 5 is for the last week within a month
-- 1 is for sunday
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Learned something new 🙂
Looks like there is a SAS function for almost everything. ....hopefully we will also get "call zero()/call value()" one day.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Patrick,
OP's statement is also brilliant , which remind me to learn this idea from yours .