<?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: Difference in output when using WHERE statement on DATA line or below SET line in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Difference-in-output-when-using-WHERE-statement-on-DATA-line-or/m-p/850393#M336091</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE=variable=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When used in a data step is an assignment statement NOT a WHERE statement.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try using valid syntax.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE variable = 1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 19 Dec 2022 21:38:24 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2022-12-19T21:38:24Z</dc:date>
    <item>
      <title>Difference in output when using WHERE statement on DATA line or below SET line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-in-output-when-using-WHERE-statement-on-DATA-line-or/m-p/850391#M336089</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I realised that the subset of data SAS creates when I use the WHERE statement in different lines is different.&lt;/P&gt;
&lt;P&gt;For example, I often use:&lt;/P&gt;
&lt;P&gt;DATA x (WHERE=(variable=1)&lt;/P&gt;
&lt;P&gt;SET y&lt;/P&gt;
&lt;P&gt;. . .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I recently used&lt;/P&gt;
&lt;P&gt;DATA x;&lt;/P&gt;
&lt;P&gt;SET y;&lt;/P&gt;
&lt;P&gt;WHERE=variable=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;. . .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the outputs were different. Would someone please explain to me why there is a difference?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 21:24:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-in-output-when-using-WHERE-statement-on-DATA-line-or/m-p/850391#M336089</guid>
      <dc:creator>Angmar</dc:creator>
      <dc:date>2022-12-19T21:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Difference in output when using WHERE statement on DATA line or below SET line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-in-output-when-using-WHERE-statement-on-DATA-line-or/m-p/850392#M336090</link>
      <description>&lt;P&gt;Hi Angmar,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The difference there is that the first example, using where as a dataset option on the data statement, subsets the &lt;EM&gt;output&lt;/EM&gt; dataset &lt;EM&gt;after&lt;/EM&gt; all the processing in the data step has been done. The second example, using the where statement, subsets the &lt;EM&gt;input&lt;/EM&gt; dataset(s)&amp;nbsp;&lt;EM&gt;before&lt;/EM&gt; all of the data processing. So, if the value of "variable" changes at all during the data step, the results of those two examples will be different.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that explains it for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Joshua&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 21:34:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-in-output-when-using-WHERE-statement-on-DATA-line-or/m-p/850392#M336090</guid>
      <dc:creator>mtnbikerjoshua</dc:creator>
      <dc:date>2022-12-19T21:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Difference in output when using WHERE statement on DATA line or below SET line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-in-output-when-using-WHERE-statement-on-DATA-line-or/m-p/850393#M336091</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE=variable=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When used in a data step is an assignment statement NOT a WHERE statement.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try using valid syntax.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE variable = 1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Dec 2022 21:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-in-output-when-using-WHERE-statement-on-DATA-line-or/m-p/850393#M336091</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2022-12-19T21:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Difference in output when using WHERE statement on DATA line or below SET line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-in-output-when-using-WHERE-statement-on-DATA-line-or/m-p/850394#M336092</link>
      <description>Thank you very much! I understand now.</description>
      <pubDate>Mon, 19 Dec 2022 21:40:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-in-output-when-using-WHERE-statement-on-DATA-line-or/m-p/850394#M336092</guid>
      <dc:creator>Angmar</dc:creator>
      <dc:date>2022-12-19T21:40:55Z</dc:date>
    </item>
  </channel>
</rss>

