If you can adjust your date format, it can be acheived easily with the below code. Hope it will help you a bit %macro diff_date (begin = ,end = today() ,y = years ,m = months ,d = days ); *--number of full months between dates; &m = intck('month', &begin, &end) -(day(&end) < day(&begin)); *--number of full years between dates; &y = floor(&m / 12); *--remainder of full months after removing full years; &m = mod(&m , 12); *--number of days remaining after removing years and months; &d = ( day(&end) < day(&begin)) * day(intnx('month',&begin,1)-1) + day(&end) - day(&begin); %mend; data _null_; ValuationDate= '31jan2008'd; MaturityDate= '01mar2009'd; %diff_date(begin=ValuationDate, end=MaturityDate) put years= months= days= ; run;
... View more