<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: problem in creating compound intrest for months in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/problem-in-creating-compound-intrest-for-months/m-p/373164#M2892</link>
    <description>&lt;P&gt;Your code seems to be syntactily correct, not sure how I can guess what is "wrong". &amp;nbsp;Follow the guidance found by Post button on new posts - post example test data as a datastep (so we can see some data and structure), post example required output, and explain any logic between the two. &amp;nbsp;The compound part seems to indicate you want to retain the value, but can't tell from that.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jul 2017 08:17:22 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-07-05T08:17:22Z</dc:date>
    <item>
      <title>problem in creating compound intrest for months</title>
      <link>https://communities.sas.com/t5/SAS-Studio/problem-in-creating-compound-intrest-for-months/m-p/373160#M2890</link>
      <description>&lt;P&gt;i want compound interest for eaach month till 25 years but something is wrong with my code kindly help;-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Compound_intrest2;&lt;BR /&gt;rate = 0.07;&lt;BR /&gt;do years = 1 to 25;&lt;BR /&gt;amount = 500000;&lt;BR /&gt;intrest + (intrest+amount)*rate;&lt;BR /&gt;totalamount + (amount + intrest);&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 07:53:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/problem-in-creating-compound-intrest-for-months/m-p/373160#M2890</guid>
      <dc:creator>jonty</dc:creator>
      <dc:date>2017-07-05T07:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: problem in creating compound intrest for months</title>
      <link>https://communities.sas.com/t5/SAS-Studio/problem-in-creating-compound-intrest-for-months/m-p/373161#M2891</link>
      <description>&lt;P&gt;Well, you do have several issues with the code. &amp;nbsp;Here are the biggest ones. &amp;nbsp;There is no mention of MONTH anywhere. &amp;nbsp;AMOUNT gets added to the total amount every year. &amp;nbsp;Here's one possibility:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data compounded;&lt;/P&gt;
&lt;P&gt;rate = 0.07;&lt;/P&gt;
&lt;P&gt;current_amount = 500000;&lt;/P&gt;
&lt;P&gt;do years = 1 to 25;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;do months = 1 to 12;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; interest = current_amount * (rate / &lt;FONT color="#ff0000"&gt;12&lt;/FONT&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; current_amount = current_amount + interest;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The OUTPUT statement is optional, depending on whether you want to see a separate set of numbers for each month or not.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 12:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/problem-in-creating-compound-intrest-for-months/m-p/373161#M2891</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-05T12:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: problem in creating compound intrest for months</title>
      <link>https://communities.sas.com/t5/SAS-Studio/problem-in-creating-compound-intrest-for-months/m-p/373164#M2892</link>
      <description>&lt;P&gt;Your code seems to be syntactily correct, not sure how I can guess what is "wrong". &amp;nbsp;Follow the guidance found by Post button on new posts - post example test data as a datastep (so we can see some data and structure), post example required output, and explain any logic between the two. &amp;nbsp;The compound part seems to indicate you want to retain the value, but can't tell from that.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2017 08:17:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/problem-in-creating-compound-intrest-for-months/m-p/373164#M2892</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-05T08:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: problem in creating compound intrest for months</title>
      <link>https://communities.sas.com/t5/SAS-Studio/problem-in-creating-compound-intrest-for-months/m-p/373226#M2902</link>
      <description>&lt;P&gt;I like to use a formula with exponentiation instead of adding up:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data compound_intrest2;
rate = 0.07;
amount = 500000;
year = 1;
month = 1;
endyear = 25;
endmonth = 12;
total_months = 0;
do until (year &amp;gt;= endyear and month &amp;gt;= endmonth);
  total_months + 1;
  tot_amount = amount * (rate/12 + 1) ** total_months; /* I guess that rate is a yearly value */
  curr_interest = tot_amount - amount * (rate/12 + 1) ** (total_months - 1);
  tot_interest = tot_amount - amount;
  output;
  month + 1;
  if month &amp;gt; 12
  then do;
    year + 1;
    month = 1;
  end;
end;
drop endyear endmonth total_months; /* not needed any longer */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Jul 2017 12:19:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/problem-in-creating-compound-intrest-for-months/m-p/373226#M2902</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-05T12:19:20Z</dc:date>
    </item>
  </channel>
</rss>

