$85,000 federal student loan at annual interest rate of 7% and a payment of $500 every month. When the principal hits $50,000, the annual interest rate drops to 5%. When the principal gets down to $30,000, the annual interest rate drops to 3%. using a Do Loop how would I calculate how many years it would take to pay off the loan?
Variations on this question have been asked quite a few times.
If you want help with this, you probably have to do a little more of the work. For example, write a program that calculates the balance remaining after 1 month. That way, it becomes apparent that you are not just looking for somebody to do your homework for you.
Here's the logic wrapped in a do loop:
data payments;
principal=85000;
do month=1 by 1 until (principal=0);
*depending upon principal set yearly rate;
*calculate one-month interest using principal and rate;
*establish payment size (either $500 or current principal + interest, whichever is smaller);
*using old principal, payment size, and calculated interest, calculate new principal
*output a record, if wanted;
end;
* After the loop, from the value of MONTH, generate the number of years (it's a long time)
run;
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.