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;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.