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.
There we go. Thank you! Starring myself blind on this one.
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.
Cool stuff. Thank you both 🙂
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.