<?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: ds2 loop practise question in SAS Academy for Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/ds2-loop-practise-question/m-p/630901#M560</link>
    <description>&lt;P&gt;That is expected behavior.&amp;nbsp; &amp;nbsp;When the index variable is step adjusted to fall outside the DO range the loop is terminated.&amp;nbsp; In this case the step adjustment (BY value) is implicitly +1 because there is no explicit BY.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The GRANDTOT computation is done &lt;U&gt;before&lt;/U&gt; the DO statement steps in the index variable TOTALB past the TO value (3), So you get GRANDTOT 104 and TOTALB 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DS2 &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=ds2ref&amp;amp;docsetTarget=p0p2sapr15j0z4n14o4b0v1i2xb7.htm&amp;amp;locale=en" target="_self"&gt;"DO Statement"&lt;/A&gt; reference documentation for TO &lt;EM&gt;stop&amp;nbsp;&lt;/EM&gt;covers the concept in detail:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Execution continues based on the value of&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;increment&amp;nbsp;&lt;/EM&gt;&lt;SPAN&gt;until one of the following conditions is met: the value of&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;index-variable&amp;nbsp;&lt;/EM&gt;&lt;SPAN&gt;passes the value of&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;stop&lt;/EM&gt;&lt;SPAN&gt;, ...&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;FWIW, horrible coding in this practice question, would not pass code review.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Mar 2020 13:21:16 GMT</pubDate>
    <dc:creator>RichardDeVen</dc:creator>
    <dc:date>2020-03-10T13:21:16Z</dc:date>
    <item>
      <title>ds2 loop practise question</title>
      <link>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/ds2-loop-practise-question/m-p/630811#M559</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was provided with this practise exam question (image below) and cannot understand why the given answer is not:&lt;/P&gt;&lt;P&gt;Total B=3; GrandTot=104.&amp;nbsp; Indeed the answer given was&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Total B=4; GrandTot=104 which is confusing me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;After the loop has completed, wouldn't Total B = 3? The Grand total will then be 101+3=104?&lt;/P&gt;&lt;P&gt;Would be most grateful for some advice on this.&lt;/P&gt;&lt;P&gt;Thank you kindly.&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="sas_ds2_loop_question_image.jpg" style="width: 471px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36717i193B5E99314E825E/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas_ds2_loop_question_image.jpg" alt="sas_ds2_loop_question_image.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 08:10:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/ds2-loop-practise-question/m-p/630811#M559</guid>
      <dc:creator>Daniel121181</dc:creator>
      <dc:date>2020-03-10T08:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: ds2 loop practise question</title>
      <link>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/ds2-loop-practise-question/m-p/630901#M560</link>
      <description>&lt;P&gt;That is expected behavior.&amp;nbsp; &amp;nbsp;When the index variable is step adjusted to fall outside the DO range the loop is terminated.&amp;nbsp; In this case the step adjustment (BY value) is implicitly +1 because there is no explicit BY.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The GRANDTOT computation is done &lt;U&gt;before&lt;/U&gt; the DO statement steps in the index variable TOTALB past the TO value (3), So you get GRANDTOT 104 and TOTALB 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DS2 &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=ds2ref&amp;amp;docsetTarget=p0p2sapr15j0z4n14o4b0v1i2xb7.htm&amp;amp;locale=en" target="_self"&gt;"DO Statement"&lt;/A&gt; reference documentation for TO &lt;EM&gt;stop&amp;nbsp;&lt;/EM&gt;covers the concept in detail:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Execution continues based on the value of&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;increment&amp;nbsp;&lt;/EM&gt;&lt;SPAN&gt;until one of the following conditions is met: the value of&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;index-variable&amp;nbsp;&lt;/EM&gt;&lt;SPAN&gt;passes the value of&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;stop&lt;/EM&gt;&lt;SPAN&gt;, ...&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;FWIW, horrible coding in this practice question, would not pass code review.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 13:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/ds2-loop-practise-question/m-p/630901#M560</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-03-10T13:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: ds2 loop practise question</title>
      <link>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/ds2-loop-practise-question/m-p/744863#M1034</link>
      <description>&lt;P&gt;Thank you very much for your answer Richard and apologies for the delay in replying.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jun 2021 04:49:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/ds2-loop-practise-question/m-p/744863#M1034</guid>
      <dc:creator>Daniel121181</dc:creator>
      <dc:date>2021-06-01T04:49:32Z</dc:date>
    </item>
  </channel>
</rss>

