hi I am looking to calculate interest for 6 months. where interest is compounded monthly. I have try to use do loop something like this but it doesnt calculate for 6 months. it only give me interest for first month. help please.
do i = 1 to 6;
balance=total_balance;
interest+(((balance*rate)/100)/365)*30;
bal_1=balance+Interest;
end;
You probably want to add an OUTPUT statement to your loop.
do i = 1 to 6;
balance=total_balance;
interest+(((balance*rate)/100)/365)*30;
bal_1=balance+Interest;
output;
end;
If you want multiple variables with the different months you may want an array instead.
Here's a tutorial on using Arrays in SAS
https://stats.idre.ucla.edu/sas/seminars/sas-arrays/
@SASUser0001 wrote:
hi I am looking to calculate interest for 6 months. where interest is compounded monthly. I have try to use do loop something like this but it doesnt calculate for 6 months. it only give me interest for first month. help please.
do i = 1 to 6;
balance=total_balance;
interest+(((balance*rate)/100)/365)*30;
bal_1=balance+Interest;
end;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.