Not sure why you're using both MDY and INTNX, I'd probably recommend sticking with the same one.
This works fine for me.
data demo;
format date date9.;
input date date9.;
cards;
01Jan2014
03Jan2018
01Oct2014
31Oct2014
01Nov2015
30Nov2016
01Dec2016
31Dec2017
01Apr2018
30Sep2015
;;;;
run;
proc sql;
create table want as
select *, case when month(date) in (10, 11, 12) then intnx('year', date, 3, 'e')
else intnx('month', date, 39, 's') end as due_date format=date9.
from demo;
quit;
@maliksmom2000 wrote:
Scenario - I have a column with a due date. If the month is 10,11 or 12, the due date is December 31st of three years from the due date. If the month due is in months 1-9, it's due on the same day just 39 months from the due date. I had two formulas provided to me but they aren't coming back right:
ifn(MONTH(t1.INACMSA) in (10,11,12), MDY(MONTH(t1.INACMSA),DAY(t1.INACMSA),YEAR(t1.INACMSA)+3),INTNX('MONTH',t1.INACMSA,39,'S'))
ifn(MONTH(t1.INACMSA) IN (10,11,12), MDY(12,31,YEAR(t1.INACMSA)+3),intnx('MONTH',t1.INACMSA,36,'S'))
... View more