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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2461 views
  • 1 like
  • 2 in conversation