Contributor
Posts: 50

# Financial Calculations - Future Value based on Continuous and Compounding Interest

[ Edited ]

HI,

on January 1 of each year,\$5000 is invested in an amount .complete the data step with do loop to determine  the value of the account after 15 years 1) if a constant annual invest rate of 10% is expected .2)if a compounding annual interest rate of 10 % is expected .?

wht should be the code ??

Contributor
Posts: 50

## DO LOOP

[ Edited ]

HI,

on January 1 of each year,\$5000 is invested in an amount .complete the data step with do loop to determine  the value of the account after 15 years 1) if a constant annual invest rate of 10% is expected .2)if a compounding annual interest rate of 10 % is expected .?

wht should be the code ??

this is my code :

``````DATA WORK.INVEST1;
DO COUNT=1 TO 15;
CAPITAL +5000;
CAPITAL+(CAPITAL*.10);
output;
END;
RUN;``````

Super User
Posts: 23,776

## Re: DO LOOP

That looks pretty close. I'm not sure what the first requirement means though? Does that mean you invest an additional 10% each, on top of the 5000/year?

1) if a constant annual invest rate of 10% is expected
Contributor
Posts: 50

## Re: DO LOOP

hi,

what should be the code for partone and part second ??

Super User
Posts: 23,776

## Re: DO LOOP

You have the second requirement.

I dont understand the first requirement. If you clarify it, perhaps someone can help.

Super User
Posts: 23,776

## Re: DO LOOP

Reeza wrote:

That looks pretty close. I'm not sure what the first requirement means though? Does that mean you invest an additional 10% each, on top of the 5000/year?

1) if a constant annual invest rate of 10% is expected

Super User
Posts: 10,787

## Re: DO LOOP

if it is continuous compounding, formula should look like this ?

5000*e^0.1*15 +

5000*e^0.1*14 +

.......

5000*e^0.1*1

``````
data _null_;
do year=1 to 15;
CAPITAL+5000*constant('e')**(0.1*year);
put year= CAPITAL=;
end;
run;``````
Super User
Posts: 23,776

## Re: DO LOOP

No, because doing *1.1 each year will account for the compounding.

But this is an exercise for any actual calculation there are SAS functions that will handle this.

Contributor
Posts: 50

## DOLOOP2

HI,

on January 1 of each year,\$5000 is invested in an amount .complete the data step with do loop to determine  the value of the account after 15 years 1) if a constant annual invest rate of 10% is expected .2)if a compounding annual interest rate of 10 % is expected .?

wht should be the code ??

Super User
Posts: 23,776

## Re: DOLOOP2

For Q1 is it invest rate or interest rate?

Contributor
Posts: 50

## Re: DOLOOP2

HI,

For q1, it is interest rate.

what should be the code ?

Contributor
Posts: 50

## Re: DOLOOP2

hi,

for Q1) if a constant annual interest rate of 10% is expected.?

what should be the code ?

Super User
Posts: 23,776

## Re: DOLOOP2

@Ksharp code was correct then - it uses a continuous interest rate formula that you can find via google.

http://www.mathwarehouse.com/compound-interest/continuously-compounded-interest.php

This answer may not be correct, it depends partly on when you account for the 5000, beginning or end of year. This assumes beginning of the year.

Good Luck.

``````data want;
capital1=0;capital2=0;
do year=1 to 15;
capital1 = (capital1+5000)*constant('e')**0.1;
capital2 = (capital2+5000)*1.1;
output;
end;
run;

proc print data=want;
run;``````

Discussion stats
• 12 replies
• 848 views
• 0 likes
• 3 in conversation