<?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: loops in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372736#M89166</link>
    <description>&lt;P&gt;i &amp;nbsp;just started learning SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;p=100000;&lt;/P&gt;&lt;P&gt;int=.10;&lt;/P&gt;&lt;P&gt;do i = 1 to 5;&lt;/P&gt;&lt;P&gt;p+p*int;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;this code will over right the orginal data&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jul 2017 13:45:27 GMT</pubDate>
    <dc:creator>shivamarrora0</dc:creator>
    <dc:date>2017-07-03T13:45:27Z</dc:date>
    <item>
      <title>loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372729#M89164</link>
      <description>&lt;P&gt;I want to do using loops&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, i have below data&lt;/P&gt;&lt;P&gt;p=100000&lt;/P&gt;&lt;P&gt;interest=10%&lt;/P&gt;&lt;P&gt;&amp;nbsp;will be the total amount after 4 years&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want below screen result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Year&lt;/TD&gt;&lt;TD&gt;Principal&lt;/TD&gt;&lt;TD&gt;interest&lt;/TD&gt;&lt;TD&gt;sum&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;100000&lt;/TD&gt;&lt;TD&gt;0.1&lt;/TD&gt;&lt;TD&gt;110000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;11000&lt;/TD&gt;&lt;TD&gt;0.1&lt;/TD&gt;&lt;TD&gt;12100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;12100&lt;/TD&gt;&lt;TD&gt;0.1&lt;/TD&gt;&lt;TD&gt;13310&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;13310&lt;/TD&gt;&lt;TD&gt;0.1&lt;/TD&gt;&lt;TD&gt;14641&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 03 Jul 2017 13:33:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372729#M89164</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-07-03T13:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372732#M89165</link>
      <description>&lt;P&gt;Please show the code you already have (as this "problem" is really simple), and where it does not meet your expectations.&lt;/P&gt;
&lt;P&gt;If you get unexpected messages in the log, post the log of the whole step.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 13:39:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372732#M89165</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-03T13:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372736#M89166</link>
      <description>&lt;P&gt;i &amp;nbsp;just started learning SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;p=100000;&lt;/P&gt;&lt;P&gt;int=.10;&lt;/P&gt;&lt;P&gt;do i = 1 to 5;&lt;/P&gt;&lt;P&gt;p+p*int;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;this code will over right the orginal data&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 13:45:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372736#M89166</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-07-03T13:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372737#M89167</link>
      <description>i &amp;nbsp;just started learning SAS.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;data test;&lt;BR /&gt;p=100000;&lt;BR /&gt;int=.10;&lt;BR /&gt;do i = 1 to 5;&lt;BR /&gt;p+p*int;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;this code will over right the original data</description>
      <pubDate>Mon, 03 Jul 2017 13:46:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372737#M89167</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-07-03T13:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372738#M89168</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144247"&gt;@shivamarrora0&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;i &amp;nbsp;just started learning SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test;&lt;/P&gt;
&lt;P&gt;p=100000;&lt;/P&gt;
&lt;P&gt;int=.10;&lt;/P&gt;
&lt;P&gt;do i = 1 to 5;&lt;/P&gt;
&lt;P&gt;p+p*int;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;this code will over right the orginal data&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When you run a data step that does not have an explicit output statement, SAS will do one everytime it reaches the end of a data step iteration. See it as a hidden "output" right before the run statement.&lt;/P&gt;
&lt;P&gt;If you do not have a statement that let's SAS iterate automatically (like a set that reads from a dataset), then SAS will only do one iteration, and that's it.&lt;/P&gt;
&lt;P&gt;So in your case, SAS performs the loop, and then writes one observation with the final values.&lt;/P&gt;
&lt;P&gt;To get a series of observations, add the explicit output statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
p = 100000;
int = .10;
do i = 1 to 5;
  p + p * int;
  output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 13:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372738#M89168</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-03T13:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372740#M89169</link>
      <description>Thanks for the explanation , if possible can you please tell the code&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Jul 2017 13:57:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372740#M89169</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-07-03T13:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372741#M89170</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144247"&gt;@shivamarrora0&lt;/a&gt; wrote:&lt;BR /&gt;Thanks for the explanation , if possible can you please tell the code&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I already supplied the code.&lt;/P&gt;
&lt;P&gt;I usually solve such problems a little differently, though:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
base = 100000;
int = .10;
do i = 0 to 5;
  p = base * (1 + int) ** i;
  output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;With that formula, you can calculate the value for any year in one single step.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 14:06:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/loops/m-p/372741#M89170</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-03T14:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: loops</title>
      <link>https://communities.sas.com/t5/SAS-Programming/loops/m-p/406064#M98820</link>
      <description>&lt;P&gt;if i invest $5000 each year in account .&amp;nbsp; after 15 yrs annual rate=10% and compound annual interest rate=10%.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;also if a fixed term deposite of 25 yrs . Clculate total amount end of term with initial amount 1,00,000. annual interst rate 7%&lt;/P&gt;&lt;P&gt;.find compounded annually and monthly .&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 18:10:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/loops/m-p/406064#M98820</guid>
      <dc:creator>mehak</dc:creator>
      <dc:date>2017-10-20T18:10:57Z</dc:date>
    </item>
  </channel>
</rss>

