Do-loop question

Reply
Contributor
Posts: 30

Do-loop question

1.if i invest $5000 each year in account .  after 15 yrs annual rate=10% and compound annual interest rate=10%.

 

2.also if a fixed term deposit of 25 yrs . Calculate total amount end of term with initial amount 1,00,000. annual interest rate 7%

.find compounded annually and monthly .

Super User
Posts: 13,338

Re: Do-loop question

Sounds like homework so I'll provide a couple hints: Functions available in data step coding: SAVING

 

Note that many of the finance functions have 3, 4 or more parameters. The answer depends on which one you leave as missing.

 

Express interest as decimals: 0.05 instead of 5%, and pay attention to compounding intervals.

Contributor
Posts: 30

Re: Do-loop question

[ Edited ]

is this the correct way to solve 1 st one

data work.invest;

do month=1 to 15;

Capital+5000;

capital+(capital*.10);

output;

end;

run;

 

2. data work.invest;

amount=500000;

rate=0.07;

do month =1 to 25 ;

earned+5000;

output;

end;

run;

title 'output dataset :Compounded monthly';

run;

proc print data=work.invest;

title 'output dataset :Compound Monthly';

run;

/* Compounded ANNUALLY */

data work.invest;

amount=500000;

rate=0.07;

do year =1 to 25;

earned+5000;

earned+(amount+earned)*rate;

output;

end;

run;

title 'output dataset :Compounded annually';

run;

proc print data=work.invest;

title 'output dataset :Compound annually';

run;

Super User
Posts: 23,323

Re: Do-loop question

That's your homework. What's your question for us?

Note: that it's less likely to get an answer to homework style questions without showing any effort.

 


mehak wrote:

1.if i invest $5000 each year in account .  after 15 yrs annual rate=10% and compound annual interest rate=10%.

 

2.also if a fixed term deposit of 25 yrs . Calculate total amount end of term with initial amount 1,00,000. annual interest rate 7%

.find compounded annually and monthly .


 

 

Contributor
Posts: 30

Re: Do-loop question

is this the correct way to solve 1 st one 

data work.invest;
do month=1 to 15;
Capital+5000;
capital+(capital*.10);
output;
end;
run;

 

 

2.

data work.invest;
amount=500000;
rate=0.07;
do month =1 to 25 ;
earned+5000;

output;
end;
run;
title 'output dataset :Compounded monthly';
run;
proc print data=work.invest;
title 'output dataset :Compound Monthly';
run;


/* Compounded ANNUALLY */


data work.invest;
amount=500000;
rate=0.07;
do year =1 to 25;
earned+5000;
earned+(amount+earned)*rate;
output;
end;
run;

title 'output dataset :Compounded annually';
run;
proc print data=work.invest;
title 'output dataset :Compound annually';
run;

Ask a Question
Discussion stats
  • 4 replies
  • 102 views
  • 0 likes
  • 3 in conversation