<?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: two WHERE statements in a data step in Programming 1 and 2</title>
    <link>https://communities.sas.com/t5/Programming-1-and-2/two-WHERE-statements-in-a-data-step/m-p/787067#M1018</link>
    <description>&lt;P&gt;While this is valid and works, I would not even teach it, as sooner or later someone comes up with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where condition1;
/* 1000 lines of data step code */
where same and condition2;
/* another 1000 lines of data step code */
where same and condition3;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which is horrible to debug and maintain.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Dec 2021 08:10:09 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-12-22T08:10:09Z</dc:date>
    <item>
      <title>two WHERE statements in a data step</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/two-WHERE-statements-in-a-data-step/m-p/787057#M1015</link>
      <description>&lt;P&gt;I tried a data step with &lt;STRONG&gt;two where statements&lt;/STRONG&gt; and realised that &lt;STRONG&gt;only the second where condition is affecting&lt;/STRONG&gt; the output - see sample code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;data result_2where_conditions;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;set class_birthdate;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;where Registration = 'C';&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;where Age = 12;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Can somebody shed some light on why this happens?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thanks heaps.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 05:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/two-WHERE-statements-in-a-data-step/m-p/787057#M1015</guid>
      <dc:creator>mlm155</dc:creator>
      <dc:date>2021-12-22T05:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: two WHERE statements in a data step</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/two-WHERE-statements-in-a-data-step/m-p/787059#M1016</link>
      <description>&lt;P&gt;Only one WHERE statement can take effect, the second overrides the first. Combine both conditions in one statement with AND.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 06:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/two-WHERE-statements-in-a-data-step/m-p/787059#M1016</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-12-22T06:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: two WHERE statements in a data step</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/two-WHERE-statements-in-a-data-step/m-p/787065#M1017</link>
      <description>Alternatively, add the keyword SAME to the second WHERE statement:  &lt;BR /&gt;&lt;BR /&gt;where same and age=12;</description>
      <pubDate>Wed, 22 Dec 2021 08:05:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/two-WHERE-statements-in-a-data-step/m-p/787065#M1017</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-12-22T08:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: two WHERE statements in a data step</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/two-WHERE-statements-in-a-data-step/m-p/787067#M1018</link>
      <description>&lt;P&gt;While this is valid and works, I would not even teach it, as sooner or later someone comes up with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where condition1;
/* 1000 lines of data step code */
where same and condition2;
/* another 1000 lines of data step code */
where same and condition3;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which is horrible to debug and maintain.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 08:10:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/two-WHERE-statements-in-a-data-step/m-p/787067#M1018</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-12-22T08:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: two WHERE statements in a data step</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/two-WHERE-statements-in-a-data-step/m-p/787068#M1019</link>
      <description>I agree, for simple sets of conditions.  For complex sets of conditions, it can be easier to read the "same and" version.</description>
      <pubDate>Wed, 22 Dec 2021 08:14:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/two-WHERE-statements-in-a-data-step/m-p/787068#M1019</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-12-22T08:14:10Z</dc:date>
    </item>
  </channel>
</rss>

