Hi,
This is the code, which excepted to return numbers from 1 to 40 in "Cohort" column,
but from some reason returns numbers to 41 and duplicate the last result in "FV" column.
What do I miss?
%let Grossid = 1; %let DmeiNihul = 0.014; %let NetPremium = 94; Data A; Target = 0; Rate = (1+0)/(1+&Grossid*&DmeiNihul)-1; do Period = 1 to 4; do Cohort = 1 to 40; If Period = 1 Then do; If Target = 0 Then FV = 0; Else FV = Finance('PV',rate,Cohort,&NetPremium*(-1),0,1)*(1+rate)**cohort; end; Else FV = Finance('PV',rate,Cohort,&NetPremium*(-1),0,1)*(1+rate)**cohort; output; end; output; end; run;
Remove the last output; statement
Hello,
If you get rid of the last output; statement (run; line minus 2).
Does that give you what you want?
At least there's no cohort 41 then.
Koen
Thank you!
It works.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.