Hi, I met a problem when calculating the difference of months between two dates. Here are the sample codes:
data test;
dt1 = "25Aug2011"d;
dt2 = "23Feb2012"d;
dt1_dt2 = intck("month",dt1,dt2,"c");
dt2_dt1 = intck("month",dt2,dt1,"c");
format dt1 dt2: yymmdd10.;
run;
Here I calculated the month difference between date1 2011-08-25 and date2 2012-02-23. When I put date1 before date2 (dt1_dt2) in the INTCK function, it returns 5, because the time interval is slightly <6 months. However, when I put date2 before date1 (dt2_dt1), it returns -6. Shouldn't it be -5, since I just changed the order of two dates? Anyone can help me with it?
Thanks!
... View more