BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
IgorR
Quartz | Level 8

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Remove the last output; statement

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Remove the last output; statement

--
Paige Miller
sbxkoenk
SAS Super FREQ

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

IgorR
Quartz | Level 8

Thank you!

It works.

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 775 views
  • 4 likes
  • 3 in conversation