Hi:
Using either a modified version of Scott's method or a modified version of Peter's method, it is possible to either come CLOSE to your 12.6 or exactly hit your 12.677. See the attached modified program and log output. If all you wanted was the 12.6, then either of the modified methods will give you that number. If you want -exactly- 12.677...
cynthia
[pre]
467 data _null_;
468 format s_dt l_dt l_dt_end s_dt_end l_dt_beg date9.;
469 s_dt = mdy(12,25,2008);
470 l_dt = mdy(1,15,2010);
471
472 ** Scott B Original Calc;
473 months = intck('month',s_dt,l_dt);
474 l_dt_end = intnx('month',l_dt,0,'e');
475 dec_month_sb_orig = months + day(l_dt) / day(l_dt_end);
476
477 ** Peter C. Suggestion Modified;
478 dec_months_pc = (l_dt - s_dt) /(365.25/12);
479
480 ** get the END of the start date and the BEGIN of the Last date;
481 s_dt_end = intnx('month',s_dt,0,'e');
482 l_dt_beg = intnx('month',l_dt,0,'b');
483
484 ** because INTCK returns whole intervals, subtract 1 day from the;
485 ** beginning of the last date -- this will give you 12 months instead of 13;
486 newmonth = intck('month',s_dt,l_dt_beg-1);
487
488 ** Now, figure out how many days from the start day to the end of the start month;
489 ** and the number of days in the last date;
490 daysleft = (s_dt_end -s_dt) + day(l_dt);
491
492 ** Do the modified formula using DAYSLEFT and NEWMONTH;
493 dec_month_sb_alt = newmonth + (daysleft / day(l_dt_end));
494
495 putlog s_dt= s_dt_end= l_dt= l_dt_beg= l_dt_end=;
496 putlog '***** ***** ***** *****';
497 putlog "Scott Original Calc:";
498 putlog dec_month_sb_orig=;
499 putlog '***** ***** ***** *****';
500 putlog "Peter Suggestion Modified";
501 putlog dec_months_pc=;
502 putlog '***** ***** ***** *****';
503 putlog "Using DAYSLEFT by modifying Scott's Original Calc";
504 putlog daysleft= newmonth= dec_month_sb_alt=;
505 run;
s_dt=25DEC2008 s_dt_end=31DEC2008 l_dt=15JAN2010 l_dt_beg=01JAN2010 l_dt_end=31JAN2010
***** ***** ***** *****
Scott Original Calc:
dec_month_sb_orig=13.483870968
***** ***** ***** *****
Peter Suggestion Modified
dec_months_pc=12.681724846
***** ***** ***** *****
Using DAYSLEFT by modifying Scott's Original Calc
daysleft=21 newmonth=12 dec_month_sb_alt=12.677419355
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
[/pre]