<?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: A Question about the Combination of DO-Loop and OUTPUT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-Question-about-the-Combination-of-DO-Loop-and-OUTPUT/m-p/420744#M103541</link>
    <description>&lt;P&gt;i is set to 1, and 1 is less than or equal to 10 so the loop continues&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;i is set to 10, and 10 is less than or equal to 10 so the loop continues&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;i is set to 11, and 11 is not less than or equal to 10 so the&amp;nbsp;code in the loop is not executed and SAS goes on to the next statement.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;i is 11 at output time.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Dec 2017 11:38:10 GMT</pubDate>
    <dc:creator>WarrenKuhfeld</dc:creator>
    <dc:date>2017-12-13T11:38:10Z</dc:date>
    <item>
      <title>A Question about the Combination of DO-Loop and OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Question-about-the-Combination-of-DO-Loop-and-OUTPUT/m-p/420742#M103539</link>
      <description>&lt;P&gt;When I executed codes below, I got 11 in variable i. Why it is not 10? Could you kindly explain a little more regarding to how SAS works in this case? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
   do i = 1 to 10;
   end;
   output;
run;

proc print data=a;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 11:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Question-about-the-Combination-of-DO-Loop-and-OUTPUT/m-p/420742#M103539</guid>
      <dc:creator>ChHUA</dc:creator>
      <dc:date>2017-12-13T11:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: A Question about the Combination of DO-Loop and OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Question-about-the-Combination-of-DO-Loop-and-OUTPUT/m-p/420743#M103540</link>
      <description>&lt;P&gt;The do loop value is incremented by the step value (default is 1) at the encounter of an end statement.&amp;nbsp; Therefore the end result of your code is one more than the do loop, and that is output.&amp;nbsp; The code within the do loop is only executed until incrementor is above the high limit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can read the documentation on do loops:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_odsgraph_sect032.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_odsgraph_sect032.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 11:34:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Question-about-the-Combination-of-DO-Loop-and-OUTPUT/m-p/420743#M103540</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-12-13T11:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: A Question about the Combination of DO-Loop and OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Question-about-the-Combination-of-DO-Loop-and-OUTPUT/m-p/420744#M103541</link>
      <description>&lt;P&gt;i is set to 1, and 1 is less than or equal to 10 so the loop continues&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;i is set to 10, and 10 is less than or equal to 10 so the loop continues&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;i is set to 11, and 11 is not less than or equal to 10 so the&amp;nbsp;code in the loop is not executed and SAS goes on to the next statement.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;i is 11 at output time.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 11:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Question-about-the-Combination-of-DO-Loop-and-OUTPUT/m-p/420744#M103541</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-12-13T11:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: A Question about the Combination of DO-Loop and OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Question-about-the-Combination-of-DO-Loop-and-OUTPUT/m-p/420761#M103543</link>
      <description>&lt;P&gt;While the first couple of responses outline the rules, here are a couple of DATA steps you can play with to try to get the idea:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;do k=1 to 7 by 4;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; put k=;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;put k=;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;do k=1 to 9 by 4;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; put k=;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; k = k + 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; put k=;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;put k=;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 12:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Question-about-the-Combination-of-DO-Loop-and-OUTPUT/m-p/420761#M103543</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-12-13T12:38:28Z</dc:date>
    </item>
  </channel>
</rss>

