<?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: Iterative DO LOOPS-Increment Past Specified Range in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Iterative-DO-LOOPS-Increment-Past-Specified-Range/m-p/819864#M34793</link>
    <description>&lt;P&gt;Iterated do loops ALWAYS go until the condition is no longer true. Since there is no increment included I increments by one until the value is greater than the limit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hint: With short examples like this type the code into your SAS editor and run it.&lt;/P&gt;
&lt;P&gt;Maybe place some put statements in various places to see what changes where/when.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider this short program. Copy and paste into your editor and run it then read the LOG.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   do i= 0 to 5;
     put "in loop " i=;
   end;
   put 'after loop ' i=;
run;&lt;/PRE&gt;
&lt;P&gt;You can look in the log to see what happens at each iteration and examine the data set to see what the value is when the data set is created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then look at this one:&lt;/P&gt;
&lt;PRE&gt;data example2;
   do i= 0 to 15 by 5;
     put "in loop " i=;
   end;
   put 'after loop ' i=;
run;&lt;/PRE&gt;
&lt;P&gt;"why there is a iterative do loop within the original do loop?" Better to say OUTER than original. Looks like someone is simulating a 10% increase in a value every calendar quarter within each year. Maybe a crude compound interest accumulation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jun 2022 01:07:58 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-06-23T01:07:58Z</dc:date>
    <item>
      <title>Iterative DO LOOPS-Increment Past Specified Range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Iterative-DO-LOOPS-Increment-Past-Specified-Range/m-p/819861#M34792</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="do loop question.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72620iC8117EBCFD938FF7/image-size/large?v=v2&amp;amp;px=999" role="button" title="do loop question.png" alt="do loop question.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a question from a practice exam I just took and I am not understanding how this iterative do loop works. Can anyone please explain why the increment of i goes past the specified range and why there is a iterative do loop within the original do loop? Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 00:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Iterative-DO-LOOPS-Increment-Past-Specified-Range/m-p/819861#M34792</guid>
      <dc:creator>faithmuturi94</dc:creator>
      <dc:date>2022-06-23T00:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Iterative DO LOOPS-Increment Past Specified Range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Iterative-DO-LOOPS-Increment-Past-Specified-Range/m-p/819864#M34793</link>
      <description>&lt;P&gt;Iterated do loops ALWAYS go until the condition is no longer true. Since there is no increment included I increments by one until the value is greater than the limit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hint: With short examples like this type the code into your SAS editor and run it.&lt;/P&gt;
&lt;P&gt;Maybe place some put statements in various places to see what changes where/when.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider this short program. Copy and paste into your editor and run it then read the LOG.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   do i= 0 to 5;
     put "in loop " i=;
   end;
   put 'after loop ' i=;
run;&lt;/PRE&gt;
&lt;P&gt;You can look in the log to see what happens at each iteration and examine the data set to see what the value is when the data set is created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then look at this one:&lt;/P&gt;
&lt;PRE&gt;data example2;
   do i= 0 to 15 by 5;
     put "in loop " i=;
   end;
   put 'after loop ' i=;
run;&lt;/PRE&gt;
&lt;P&gt;"why there is a iterative do loop within the original do loop?" Better to say OUTER than original. Looks like someone is simulating a 10% increase in a value every calendar quarter within each year. Maybe a crude compound interest accumulation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 01:07:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Iterative-DO-LOOPS-Increment-Past-Specified-Range/m-p/819864#M34793</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-06-23T01:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Iterative DO LOOPS-Increment Past Specified Range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Iterative-DO-LOOPS-Increment-Past-Specified-Range/m-p/828000#M35375</link>
      <description>&lt;P&gt;Excuse the lateness, but thanks so much for the response! This really helped me pass my SAS Base Certification test which had a few do loop questions. Cheers!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2022 22:12:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Iterative-DO-LOOPS-Increment-Past-Specified-Range/m-p/828000#M35375</guid>
      <dc:creator>faithmuturi94</dc:creator>
      <dc:date>2022-08-09T22:12:10Z</dc:date>
    </item>
  </channel>
</rss>

