<?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: Confusion about using SET after a STOP statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Confusion-about-using-SET-after-a-STOP-statement/m-p/329449#M271775</link>
    <description>&lt;P&gt;You can make this slightly more efficient by dropping all the variables in &amp;amp;DSN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set &amp;amp;dsn(drop=_all_) nobs=dsnobs;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;While the SET is never executed all the variables from &amp;amp;DSN are placed in the PDF by the data step compiler.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you really need this macro?&amp;nbsp; Usually the question is "does the macro have zero observations?" and knowing how many&amp;nbsp;obs adds nothing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2017 16:19:00 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2017-02-02T16:19:00Z</dc:date>
    <item>
      <title>Confusion about using SET after a STOP statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Confusion-about-using-SET-after-a-STOP-statement/m-p/329280#M271771</link>
      <description>&lt;P&gt;Can someone&amp;nbsp;please&amp;nbsp;explain why CALL SYMPUTX('numobs', dsnobs, 'g') in line 60 of the following code works? It seems to me that, since the (NOBS=DSNOBS) SET statement option in line 62 comes after the STOP statement, it will never even be executed. So how is the macro variable&amp;nbsp;NUMOBS&amp;nbsp;ever set to 144?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55 
56 * Program11.2.9.sas;
57 * Using the NOBS= option on the SET statement;
58 %macro numobs(dsn=);
59 data _null_;
60 call symputx('numobs', dsnobs, 'g');
61 stop;
62 set &amp;amp;dsn nobs=dsnobs;
63 run;
64 %mend numobs;
65 %numobs(dsn=sashelp.air)

NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.02 seconds


66 %put The number of observations in SASHELP.AIR is &amp;amp;numobs;
The number of observations in SASHELP.AIR is 144
67 
68 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
80 &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 03:06:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Confusion-about-using-SET-after-a-STOP-statement/m-p/329280#M271771</guid>
      <dc:creator>rararayayayay</dc:creator>
      <dc:date>2017-02-02T03:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion about using SET after a STOP statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Confusion-about-using-SET-after-a-STOP-statement/m-p/329283#M271772</link>
      <description>&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7066iA1F107142292A9DE/image-size/large?v=1.0&amp;amp;px=-1" border="0" alt="Screen Shot 2017-02-01 at 8.09.25 PM.png" title="Screen Shot 2017-02-01 at 8.09.25 PM.png" align="left" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p00hxg3x8lwivcn1f0e9axziw57y.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#p00hxg3x8lwivcn1f0e9axziw57y.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE class="xis-summary"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="xis-summaryTip"&gt;Tip&lt;/TD&gt;
&lt;TD class="xis-summaryText"&gt;At &lt;STRONG&gt;&lt;U&gt;compilation time&lt;/U&gt;&lt;/STRONG&gt;, SAS reads the descriptor portion of each data set and assigns the value of the NOBS= variable automatically. &lt;U&gt;&lt;STRONG&gt;Thus, you can refer to the NOBS= variable before the SET statement&lt;/STRONG&gt;&lt;/U&gt;. The variable is available in the DATA step but is not added to any output data set.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 03:12:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Confusion-about-using-SET-after-a-STOP-statement/m-p/329283#M271772</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-02T03:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion about using SET after a STOP statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Confusion-about-using-SET-after-a-STOP-statement/m-p/329287#M271774</link>
      <description>Thank you.</description>
      <pubDate>Thu, 02 Feb 2017 03:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Confusion-about-using-SET-after-a-STOP-statement/m-p/329287#M271774</guid>
      <dc:creator>rararayayayay</dc:creator>
      <dc:date>2017-02-02T03:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Confusion about using SET after a STOP statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Confusion-about-using-SET-after-a-STOP-statement/m-p/329449#M271775</link>
      <description>&lt;P&gt;You can make this slightly more efficient by dropping all the variables in &amp;amp;DSN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set &amp;amp;dsn(drop=_all_) nobs=dsnobs;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;While the SET is never executed all the variables from &amp;amp;DSN are placed in the PDF by the data step compiler.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you really need this macro?&amp;nbsp; Usually the question is "does the macro have zero observations?" and knowing how many&amp;nbsp;obs adds nothing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 16:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Confusion-about-using-SET-after-a-STOP-statement/m-p/329449#M271775</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2017-02-02T16:19:00Z</dc:date>
    </item>
  </channel>
</rss>

