<?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 Putting to the log twice, but expecting only once in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Putting-to-the-log-twice-but-expecting-only-once/m-p/96757#M20406</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose I have the following small piece of code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;SPAN style="font-size: 8pt; font-family: Courier;"&gt;&amp;nbsp; &lt;/SPAN&gt;
&lt;P align="left"&gt;data row1col1;&lt;/P&gt;

&lt;P align="left"&gt;a = 12;&lt;/P&gt;

&lt;P align="left"&gt;output;&lt;/P&gt;

&lt;P&gt;run;&lt;/P&gt;
&lt;BR /&gt; &lt;SPAN style="font-size: 8pt; font-family: Courier;"&gt;&amp;nbsp; &lt;/SPAN&gt;
&lt;P align="left"&gt;data _null_;&lt;/P&gt;

&lt;P align="left"&gt;put nobs=;&lt;/P&gt;

&lt;P align="left"&gt;*stop;&lt;/P&gt;

&lt;P align="left"&gt;set row1col1 nobs=nobs;&lt;/P&gt;

&lt;P&gt;run;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;Notice that the stop statement in the data _null_ step has been commented out. Then the code puts nobs to the log twice, but I don't understand why it doesn't just put it once, nor why it puts a non-zero value, since the "put" statement is above the "set" statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I include the stop statement, it puts nobs just once.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Aug 2012 12:12:17 GMT</pubDate>
    <dc:creator>Hedegaard</dc:creator>
    <dc:date>2012-08-17T12:12:17Z</dc:date>
    <item>
      <title>Putting to the log twice, but expecting only once</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Putting-to-the-log-twice-but-expecting-only-once/m-p/96757#M20406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose I have the following small piece of code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;SPAN style="font-size: 8pt; font-family: Courier;"&gt;&amp;nbsp; &lt;/SPAN&gt;
&lt;P align="left"&gt;data row1col1;&lt;/P&gt;

&lt;P align="left"&gt;a = 12;&lt;/P&gt;

&lt;P align="left"&gt;output;&lt;/P&gt;

&lt;P&gt;run;&lt;/P&gt;
&lt;BR /&gt; &lt;SPAN style="font-size: 8pt; font-family: Courier;"&gt;&amp;nbsp; &lt;/SPAN&gt;
&lt;P align="left"&gt;data _null_;&lt;/P&gt;

&lt;P align="left"&gt;put nobs=;&lt;/P&gt;

&lt;P align="left"&gt;*stop;&lt;/P&gt;

&lt;P align="left"&gt;set row1col1 nobs=nobs;&lt;/P&gt;

&lt;P&gt;run;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;Notice that the stop statement in the data _null_ step has been commented out. Then the code puts nobs to the log twice, but I don't understand why it doesn't just put it once, nor why it puts a non-zero value, since the "put" statement is above the "set" statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I include the stop statement, it puts nobs just once.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Aug 2012 12:12:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Putting-to-the-log-twice-but-expecting-only-once/m-p/96757#M20406</guid>
      <dc:creator>Hedegaard</dc:creator>
      <dc:date>2012-08-17T12:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Putting to the log twice, but expecting only once</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Putting-to-the-log-twice-but-expecting-only-once/m-p/96758#M20407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are numerous paper talking about this, briefly speaking,&amp;nbsp; data step will loop a 'half' loop until reach 'set' statement after the end of the data set has been reached. Considering the following&amp;nbsp; scenarios:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data row1col1;&lt;/P&gt;&lt;P&gt;a = 12;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*1. 0 obs: just a half loop*/&lt;/P&gt;&lt;P&gt;data empty;&lt;/P&gt;&lt;P&gt;set row1col1(obs=0);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;put nobs=;&lt;/P&gt;&lt;P&gt;*stop;&lt;/P&gt;&lt;P&gt;set empty nobs=nobs;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*2. with 'put' after 'set': one and half loop while not reaching 'put'*/&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;set row1col1 nobs=nobs;&lt;/P&gt;&lt;P&gt;put nobs=;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, with 'stop', it stops in the middle the loop before even one loop can be finished.&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Update: here is a paper by the famous Ian whitlock: &lt;A href="http://www2.sas.com/proceedings/sugi22/ADVTUTOR/PAPER34.PDF" title="http://www2.sas.com/proceedings/sugi22/ADVTUTOR/PAPER34.PDF"&gt;http://www2.sas.com/proceedings/sugi22/ADVTUTOR/PAPER34.PDF&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Aug 2012 12:33:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Putting-to-the-log-twice-but-expecting-only-once/m-p/96758#M20407</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-08-17T12:33:28Z</dc:date>
    </item>
  </channel>
</rss>

