May 28, 2006, 11:51 AM
S.J. KadishDATEDIF, Elapsed Months - Fraction of a month?
FOCUS warriors:
Is there some way to alter this compute so that we can get a fraction of a month:
COMPUTE ELAPSED_MONTH_COUNT/P7.1C = DATEDIF(COMMISSION_DT,MID_MONTH_DT, 'M');1.) Both of the dates are Smart Dates.
2.) The Mid-Month Date is based on the &YYM | '15'
We need to differentiate at a breaking point of 5.5 months. All of my examples have been like 4.0 months, 5.0 months, etc.
I scoped the entire site and also checked IBI TechResponse so anything you provide will be greatly appreciated.
Thanks for your help.
Happy Trails,
Sandy
May 28, 2006, 09:50 PM
PiipsterDATEDIF returns a whole number not fractions.
I take it the dates you are dealing with could be any day of any month? Not just beginning or end of month.
May 29, 2006, 09:19 AM
S.J. KadishThe mid-month date is always XXXX-XX-15. The Commission Date could be anytime in the month.
May 29, 2006, 02:15 PM
smithsSandy,
Why not get the difference in number of days, then divide by approx 30.4 to get the number of months (with decimal places). Here's an example using the MOVIES file:
DEFINE FILE MOVIES
-* Compare to today's date
TDATE/YYMD = &YYMD;
-* Get days elapsed since release date
DAYSELAP/D5 = DATEDIF(RELDATE, TDATE, 'D');
-* Convert to months elapsed since release date
MONTHSELAP/D8.2 = DAYSELAP / 30.4
END
TABLE FILE MOVIES
PRINT
MOVIECODE
RELDATE
-* TDATE
DAYSELAP
MONTHSELAP
END
Regards,
Sean