BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Shrutibhatnagar
Obsidian | Level 7

data testout1;
principle=5000;
rate=0.10;
earned=0;
do year=1 to 15;
do month=1 to 12;
earned=earned+(principle+earned)*rate;
output;
end; end;
run;

 

is it right if principle is 5000, rate 10% and calculated  for 15 years ? 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

I didn't check your code, but you can use the COMPOUND function in SAS to do this, and then you will be sure the answer is correct. Or you can compare your results to what the COMPOUND function says.

 

https://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=n0ledxl0wyn9jyn12hi34nlpp7ve.htm...

 

By the way, it seems to me that in your code, the interest rate is 10% per month, is that really what you wanted?

--
Paige Miller

View solution in original post

1 REPLY 1
PaigeMiller
Diamond | Level 26

I didn't check your code, but you can use the COMPOUND function in SAS to do this, and then you will be sure the answer is correct. Or you can compare your results to what the COMPOUND function says.

 

https://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=n0ledxl0wyn9jyn12hi34nlpp7ve.htm...

 

By the way, it seems to me that in your code, the interest rate is 10% per month, is that really what you wanted?

--
Paige Miller

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 2868 views
  • 1 like
  • 2 in conversation