I need to calculate a figure which equates to the 'nearest' number of months between two dates. However the standard SAS function (INTCK) is not geared to consider the DAY of its date parameters (eg code below resolves to 0 when I need it to round to 1).
What is the 'neatest' way of resolving this issue?
data _null_;
x="01APR08"d;
y="28APR08"d;
z=intck('MONTH',x,y);
put z= ;
run;
EDIT: response to Martins comment.
I would round to 0 months - I don't think the border is relevant. The function I am trying to replicate (NEAREST_MONTHS) comes from DCS (Sungard prophet application). Am now awaiting the chance to perform some testing within the application itself to understand more about how it treats dates (will post results back here ) ).
The help file contains the following: Category Date
Description
Returns the difference between two dates to the nearest number of months. If the second date is later than the first date then 0 is returned.
Syntax
NEAREST_MONTHS(Later_Date, Earlier_Date)
Return Type Integer
Examples
NEAREST_MONTHS(date1, date2) Returns 8 if date1 is 20/3/1997 and date2 is 23/7/1996
NEAREST_MONTHS(date1, date2) Returns 26 if date1 is 20/3/1997 and date2 is 1/2/1995