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

Dear All,

 

I am new in the Analytics. I want to learn most of the concept. i am working on basics of do loop. but i am not able to create the formula for Compound interest. Kindly Help me in this Matter.

 

thanks.

 

codes are

 

 


data CI;

principle=100000;

rate=0.10;

do year=1 to 10;

principle+principle{(1+0.10)**10};

output;
end;

run;

 

Purushottam Sharma
A students from Management college

Mob: 918130352772
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

I would strongly recommend looking in the online help for the Financial functions. Depending on the type of compounding but there is the Finance function, Mort, Saving and Yield that do a variety of different interest function calculations.

View solution in original post

6 REPLIES 6
ballardw
Super User

I would strongly recommend looking in the online help for the Financial functions. Depending on the type of compounding but there is the Finance function, Mort, Saving and Yield that do a variety of different interest function calculations.

Purushottam
Fluorite | Level 6

Dear, How can be Take the online help in Finance

Purushottam Sharma
A students from Management college

Mob: 918130352772
Reeza
Super User

You're missing principle= in your formula and your brackets don't quite make sense. Also raising it to the power of 10 doesn't make sense to me...

The following runs, but I don't think its what you want:

data CI;

principle=100000;

rate=0.10;

do year=1 to 10;

principle=principle+principle*((1+0.10)**10);

output;
end;

format principle dollar21.2;

run;
Purushottam
Fluorite | Level 6

Dear Reeza,

 

I am very thankful for your coding. thses are really working.

 

thanks a lot again.

 

 

Purushottam Sharma
A students from Management college

Mob: 918130352772
MikeZdeb
Rhodochrosite | Level 12

Hi, as suggested, a function ...

 

data ci (keep=period principle);
retain initial 100000 rate 0.10;
do period=1 to 10;
  principle = compound(initial, . , rate, period);
  output;
end;
format principle dollar10.;
run;

 

period     principle

   1        $110,000
   2        $121,000
   3        $133,100
   4        $146,410
   5        $161,051
   6        $177,156
   7        $194,872
   8        $214,359
   9        $235,795
  10        $259,374

 

your formula (via Reeza's code), very generous if savings, usury if a loan ...

 

year                principle

  1               $359,374.25
  2             $1,291,498.49
  3             $4,641,312.95
  4            $16,679,683.42
  5            $59,942,486.52
  6           $215,417,858.97
  7           $774,156,306.45
  8         $2,782,118,389.25
  9         $9,998,216,984.47
 10        $35,931,016,902.39

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 4364 views
  • 1 like
  • 4 in conversation