need solution for below question by using do loop
each year an employee invests 5000 in an account determine the value of account after 3 year based on constant intrest rate of 4.5
data _null_;
cum=0;
do n=0 to 2;
cum=cum+1.045**n;
total=5000*cum;
year=n+1;
put year= total= ;
end;
run;
Solution is to use SAS code. Realy what do you expect? You have provided nothing, where is the test data (in the form of a datastep), where is the example output. What code have you tried etc.
There's a function for that: MORT (see: http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245917.htm)
However, to use it, you'll have to specify whether the interest is compounded daily, monthly or whatever.
Art, CEO, AnalystFinder.com
data _null_;
cum=0;
do n=0 to 2;
cum=cum+1.045**n;
total=5000*cum;
year=n+1;
put year= total= ;
end;
run;
Hi
thanks for your code. i got the what i'm expecting but need one clarification on how you deceided 'cum=cum+1.045**n;'
It is equivalent with:
1
1+1.045
1+1.045+1.045**2
ok thanks but if want calcualte on simple interest then it will be 'cum=cum+1.045;' right?
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!
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.