<?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 proc sql- where clause not working in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-where-clause-not-working/m-p/346588#M79945</link>
    <description>&lt;P&gt;proc sql;&lt;BR /&gt;create table numsn&amp;nbsp;as&lt;BR /&gt;select distinct b.table,b.column,b.origin,b.originwhere,b.algorithm,b.origindescription,b.role,b.term,b.MAPSUBMITTED&lt;BR /&gt;from vcol a right join source_columns b&lt;BR /&gt;on a.origin=b.origin&lt;BR /&gt;where b.term like "(%)" or b.term="*" and b.MAPSUBMITTED="Y"&lt;BR /&gt;group by b.table,b.column,b.origin,b.originwhere,b.algorithm&lt;BR /&gt;order by b.table,b.column,b.origin,b.originwhere,b.algorithm;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But in the above code my&amp;nbsp;&lt;SPAN&gt;b.MAPSUBMITTED="Y" condition is not working as i get valiues which are not Y also. any clue where i am wrong ?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Apr 2017 07:36:31 GMT</pubDate>
    <dc:creator>alexdsa310</dc:creator>
    <dc:date>2017-04-03T07:36:31Z</dc:date>
    <item>
      <title>proc sql- where clause not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-where-clause-not-working/m-p/346588#M79945</link>
      <description>&lt;P&gt;proc sql;&lt;BR /&gt;create table numsn&amp;nbsp;as&lt;BR /&gt;select distinct b.table,b.column,b.origin,b.originwhere,b.algorithm,b.origindescription,b.role,b.term,b.MAPSUBMITTED&lt;BR /&gt;from vcol a right join source_columns b&lt;BR /&gt;on a.origin=b.origin&lt;BR /&gt;where b.term like "(%)" or b.term="*" and b.MAPSUBMITTED="Y"&lt;BR /&gt;group by b.table,b.column,b.origin,b.originwhere,b.algorithm&lt;BR /&gt;order by b.table,b.column,b.origin,b.originwhere,b.algorithm;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But in the above code my&amp;nbsp;&lt;SPAN&gt;b.MAPSUBMITTED="Y" condition is not working as i get valiues which are not Y also. any clue where i am wrong ?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 07:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-where-clause-not-working/m-p/346588#M79945</guid>
      <dc:creator>alexdsa310</dc:creator>
      <dc:date>2017-04-03T07:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql- where clause not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-where-clause-not-working/m-p/346590#M79947</link>
      <description>&lt;P&gt;You need brackets to ensure the AND works separately from the OR:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where (b.term like "(%)" or b.term="*") and b.MAPSUBMITTED="Y"&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Apr 2017 07:40:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-where-clause-not-working/m-p/346590#M79947</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-04-03T07:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql- where clause not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-where-clause-not-working/m-p/346591#M79948</link>
      <description>&lt;P&gt;"and" is evaluated before "or", so the first condition for b.term like "(%)" takes precedence. You may have to enclose the "or" in brackets:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;where (b.term like "(%)" or b.term="*") and b.MAPSUBMITTED="Y"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 07:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-where-clause-not-working/m-p/346591#M79948</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-03T07:42:55Z</dc:date>
    </item>
  </channel>
</rss>

