- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 01-14-2020 10:11 AM
(689 views)
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!
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Then mark this topic as solved. It makes it easier for everybody to know in advance which topics are solved and which are not.
--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set
Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets
--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set
Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets
--------------------------