<?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 conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494724#M130432</link>
    <description>&lt;P&gt;As I see there are 2 equivalent way:&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; also age&lt;SPAN class="token operator"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;25&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; same age&lt;SPAN class="token operator"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;25&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Is there a difference between "SAME" &amp;nbsp;and "ALSO"?&lt;/P&gt;</description>
    <pubDate>Wed, 12 Sep 2018 05:50:07 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2018-09-12T05:50:07Z</dc:date>
    <item>
      <title>two Where conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494714#M130425</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;May anyone explain why in the following query &amp;nbsp;we get 5 rows.&lt;/P&gt;&lt;P&gt;The condition is :&lt;/P&gt;&lt;P&gt;where Gender="M";&lt;BR /&gt;where age&amp;gt;25;&lt;/P&gt;&lt;P&gt;Does it mean that the query is taking Males AND age&amp;gt;25?&lt;/P&gt;&lt;P&gt;In the result I see also Female.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Yuli&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Raw_tbl;
input name $ Gender $ age  ;
cards;
Anna F 23
Ben M 25
Bob M 21
Brian M 27
Edward M 26
Emma F 32
Joe M 34
Sam F 32
Tom M 24
;
run;


data  tbl2;
set Raw_tbl;
where Gender="M";
where age&amp;gt;25;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Sep 2018 04:40:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494714#M130425</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-09-12T04:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: two Where conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494717#M130427</link>
      <description>&lt;P&gt;In your example the second WHERE overwrites the first one. If you want both to be used (the equivalent of using an AND between them) do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data  tbl2;
set Raw_tbl;
where Gender="M";
where also age&amp;gt;25;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Sep 2018 04:48:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494717#M130427</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-09-12T04:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: two Where conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494718#M130428</link>
      <description>&lt;P&gt;Always check your log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="5772F2AD-8D19-4C16-B22D-654B3B75E45B.jpeg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23208i460EC1ACB96B7EE3/image-size/large?v=v2&amp;amp;px=999" role="button" title="5772F2AD-8D19-4C16-B22D-654B3B75E45B.jpeg" alt="5772F2AD-8D19-4C16-B22D-654B3B75E45B.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you do want both, add an SAME AND after the second WHERE, but before age.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where same and age&amp;gt;25;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;May anyone explain why in the following query &amp;nbsp;we get 5 rows.&lt;/P&gt;
&lt;P&gt;The condition is :&lt;/P&gt;
&lt;P&gt;where Gender="M";&lt;BR /&gt;where age&amp;gt;25;&lt;/P&gt;
&lt;P&gt;Does it mean that the query is taking Males AND age&amp;gt;25?&lt;/P&gt;
&lt;P&gt;In the result I see also Female.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Yuli&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Raw_tbl;
input name $ Gender $ age  ;
cards;
Anna F 23
Ben M 25
Bob M 21
Brian M 27
Edward M 26
Emma F 32
Joe M 34
Sam F 32
Tom M 24
;
run;


data  tbl2;
set Raw_tbl;
where Gender="M";
where age&amp;gt;25;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 04:51:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494718#M130428</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-12T04:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: two Where conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494723#M130431</link>
      <description>&lt;P&gt;A clear case for Maxim 2.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 05:45:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494723#M130431</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-12T05:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: two Where conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494724#M130432</link>
      <description>&lt;P&gt;As I see there are 2 equivalent way:&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; also age&lt;SPAN class="token operator"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;25&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; same age&lt;SPAN class="token operator"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;25&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Is there a difference between "SAME" &amp;nbsp;and "ALSO"?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 05:50:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494724#M130432</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-09-12T05:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: two Where conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494738#M130438</link>
      <description>&lt;P&gt;Use logical operands in your where clause:&lt;/P&gt;
&lt;PRE&gt;where &amp;lt;condition&amp;gt; and/or &amp;lt;condition&amp;gt; and/or &amp;lt;condition&amp;gt;...;&lt;/PRE&gt;
&lt;P&gt;I have never heard of, nor seen where also or where same being used.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 07:58:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/two-Where-conditions/m-p/494738#M130438</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-09-12T07:58:20Z</dc:date>
    </item>
  </channel>
</rss>

