I want to convert time between to time points into month. if using (date2 - date1)/30, that doesn't take into account of months that have 31 days. what's the quick way of taking to account of month that have 30 and 31 days?
thank you!
I am guessing what you prolly need is to use INTCK function to get the count of monthly intervals between 2 dates
intck('month',date1,date2,'c');
/*or*/
intck('month',date1,date2);
A small test to understand
%let date1='29dec2019'd;
%let date2='05jan2020'd;
data test;
month_discrete=intck('month',&date1,&date2);
month_continuous=intck('month',&date1,&date2,'c');
run;
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.