I'm missing something in your 'want' data: ID1 ID2 OPERdate trnsdate OPERDT_HalfYr age_YR_OPDT age_QTR_OPDT age_HalfYR_OPDT 6789 1 2013Q3 2013Q4 AYH2 12 6 6 6789 1 2013Q3 2014Q1 AYH2 15 9 9 ID1 = 6789 line-1 : age_YR_OPDT is 0 years between Q3 and Q4 of the same year (2013), not 12. age_QTR_OPDT is 1 and age_HalfYR_OPDT is no more than 1. Are you looking at months? For a date informat with OPERdate and trnsdate you should be able to use YYQ6. (example of 1991Q1 comes from Professional SAS Programming Secrets). Then set OPERDT_HalfYR to intck('DTYEAR',trnsdate,OPERdate); age_YR_OPDT = intck('DTMONTH',trnsdate,OPERdate); or 'year' if you really want years. age_QTR_OPDT = intck('DTQTR',trnsdate,OPERdate); age_HalfYR_OPDT = (intck('DTQTR',trnsdate,OPERdate) / 2); there isn't a half-year function, you could try dividing the DTQTR by 2.
... View more