<?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 if condition dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/if-condition-dataset/m-p/495594#M130818</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in the below code if condition should not be executed but how i was able to print n varible&amp;nbsp; value?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;data _null_;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if -2 then set sashelp.class nobs=n;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;call symput ('nrows',n);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Sep 2018 07:07:19 GMT</pubDate>
    <dc:creator>rajeshm</dc:creator>
    <dc:date>2018-09-14T07:07:19Z</dc:date>
    <item>
      <title>if condition dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-condition-dataset/m-p/495594#M130818</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in the below code if condition should not be executed but how i was able to print n varible&amp;nbsp; value?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;data _null_;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if -2 then set sashelp.class nobs=n;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;call symput ('nrows',n);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 07:07:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-condition-dataset/m-p/495594#M130818</guid>
      <dc:creator>rajeshm</dc:creator>
      <dc:date>2018-09-14T07:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: if condition dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-condition-dataset/m-p/495595#M130819</link>
      <description>&lt;P&gt;All SET statements are always executed at compile time to to build the pdv, the IF -statement prevents execution at runtime, so that no observations are read.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 07:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-condition-dataset/m-p/495595#M130819</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-09-14T07:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: if condition dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-condition-dataset/m-p/495596#M130820</link>
      <description>&lt;P&gt;Because the n variable in nobs=n is set at compile time&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 07:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-condition-dataset/m-p/495596#M130820</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-09-14T07:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: if condition dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-condition-dataset/m-p/495615#M130830</link>
      <description>&lt;P&gt;Two reasons:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Actually, your SET statement IS executed. SAS interpretes anything not zero or missing as a TRUE boolean value, so "if -2" is equivalent to "if 1"&lt;/LI&gt;&lt;LI&gt;The NOBS option sets the variable at compile time, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt; already remarked.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The last reason is why you can get away with stuff like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  do i=1 to n;
    set x.data1 nobs=n;
    output;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So the N variable is defined and set before the loop which contains the SET statement begins execution.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 10:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-condition-dataset/m-p/495615#M130830</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2018-09-14T10:17:08Z</dc:date>
    </item>
  </channel>
</rss>

