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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.