- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi All.
Can you perhaps offer some knowledge here? Why does this
data _null_;
start='01feb2016'd;
end='29feb2016'd;
numMondays=intck('weekday134567w' ,start, end);
put numMondays;
run;
not result in numMondays=5?
Browsing the INTCK Documentation and Intervals Available to the Function, I would think that this gives me the number of 1 day week periods, considering Tuesday, Wednesday, Thursday, Friday, Saturday ans Sunday as weekend days = the number of Mondays. However, clearly this is not the case as NumMondays=4 in the code above and there are 5 Mondays in February of 2016.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
There we go. Thank you! Starring myself blind on this one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Just to help with illustrating @Astounding 's point, run this for testing:
data _null_;
start='01feb2016'd;
end='29feb2016'd;
numMondays=intck('weekday134567w' ,start, end);
put numMondays;
run;
data _null_;
start='31jan2016'd;
end='29feb2016'd;
numMondays=intck('weekday134567w' ,start, end);
put numMondays;
run;
data _null_;
start='01feb2016'd;
end='01mar2016'd;
numMondays=intck('weekday134567w' ,start, end);
put numMondays;
run;
Only the second step returns 5, as the start is now before a Monday. Moving the end to a Tuesday does not change the result, so the boundary has to be 00:00 on a given day. 29feb is already past that boundary, but 01feb is not before it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Cool stuff. Thank you both 🙂