$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;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.