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?
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: