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 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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