<?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: Question on Do loop in Programming 1 and 2</title>
    <link>https://communities.sas.com/t5/Programming-1-and-2/Question-on-Do-loop/m-p/682656#M601</link>
    <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Where you are in doubt about the answer to the quizzes in the class, it's always a good idea to write a program to test the program logic so you can understand exactly what's happening. This is where using the class techniques like PUTLOG will help you. For example, you can write a simple program to make the input bikeinfo file. Then the DATA step is given in the quiz question:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1599661606411.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49172i393612B224E0497E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1599661606411.png" alt="Cynthia_sas_0-1599661606411.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The program runs successfully and in the LOG, you see:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_1-1599661707660.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49173i1A3305135B08C77B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_1-1599661707660.png" alt="Cynthia_sas_1-1599661707660.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can compare the PUTLOG statements in the LOG to the output from PROC PRINT:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_2-1599661734097.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49174i25F5EBB0A8C86A15/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_2-1599661734097.png" alt="Cynthia_sas_2-1599661734097.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And the log shows you that 2 observations were read from WORK.BIKEINFO but that 6 observations were written to WORK.BIKEINFO2. If you compare the PUTLOG output to the PROC PRINT, you can see exactly which 6 observations were written out, one for each value of MONTH. You can tell the output was OUTSIDE of the DO loop for WEEK because the value of WEEK is 5, which means that the loop for week had ended and that the OUTPUT happened after week had been incremented from 4 to 5, which ended the WEEK loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Hope this helps explain a possible approach to validating the quiz answers in the classes.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2020 14:32:09 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2020-09-09T14:32:09Z</dc:date>
    <item>
      <title>Question on Do loop</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/Question-on-Do-loop/m-p/682462#M598</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody elaborate the explanation for the below question please? I believe only one row is read for each month when it's an implicit output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Neeharika89_1-1599611391902.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49147i4D3D6E89214570A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Neeharika89_1-1599611391902.png" alt="Neeharika89_1-1599611391902.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 00:34:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/Question-on-Do-loop/m-p/682462#M598</guid>
      <dc:creator>Neeharika89</dc:creator>
      <dc:date>2020-09-09T00:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Question on Do loop</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/Question-on-Do-loop/m-p/682464#M599</link>
      <description>&lt;P&gt;The question is not how many values are calculated, but how many OUTPUTs are implemented.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 01:05:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/Question-on-Do-loop/m-p/682464#M599</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-09-09T01:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Question on Do loop</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/Question-on-Do-loop/m-p/682488#M600</link>
      <description>&lt;P&gt;There are two input lines.&amp;nbsp;&lt;BR /&gt;There is a loop that runs for each line and outputs 3 times. So 2*3 =6.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This uses an explicit output not implicit.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/345920"&gt;@Neeharika89&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anybody elaborate the explanation for the below question please? I believe only one row is read for each month when it's an implicit output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Neeharika89_1-1599611391902.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49147i4D3D6E89214570A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Neeharika89_1-1599611391902.png" alt="Neeharika89_1-1599611391902.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 04:06:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/Question-on-Do-loop/m-p/682488#M600</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-09-09T04:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: Question on Do loop</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/Question-on-Do-loop/m-p/682656#M601</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Where you are in doubt about the answer to the quizzes in the class, it's always a good idea to write a program to test the program logic so you can understand exactly what's happening. This is where using the class techniques like PUTLOG will help you. For example, you can write a simple program to make the input bikeinfo file. Then the DATA step is given in the quiz question:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1599661606411.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49172i393612B224E0497E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1599661606411.png" alt="Cynthia_sas_0-1599661606411.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The program runs successfully and in the LOG, you see:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_1-1599661707660.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49173i1A3305135B08C77B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_1-1599661707660.png" alt="Cynthia_sas_1-1599661707660.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can compare the PUTLOG statements in the LOG to the output from PROC PRINT:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_2-1599661734097.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49174i25F5EBB0A8C86A15/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_2-1599661734097.png" alt="Cynthia_sas_2-1599661734097.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And the log shows you that 2 observations were read from WORK.BIKEINFO but that 6 observations were written to WORK.BIKEINFO2. If you compare the PUTLOG output to the PROC PRINT, you can see exactly which 6 observations were written out, one for each value of MONTH. You can tell the output was OUTSIDE of the DO loop for WEEK because the value of WEEK is 5, which means that the loop for week had ended and that the OUTPUT happened after week had been incremented from 4 to 5, which ended the WEEK loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Hope this helps explain a possible approach to validating the quiz answers in the classes.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 14:32:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/Question-on-Do-loop/m-p/682656#M601</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-09-09T14:32:09Z</dc:date>
    </item>
  </channel>
</rss>

