<?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: Proc SQL- Where clause question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Where-clause-question/m-p/640184#M190609</link>
    <description>Thank you for your help on this.&lt;BR /&gt;Appreciate it very much.</description>
    <pubDate>Wed, 15 Apr 2020 18:38:39 GMT</pubDate>
    <dc:creator>wlierman</dc:creator>
    <dc:date>2020-04-15T18:38:39Z</dc:date>
    <item>
      <title>Proc SQL- Where clause question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Where-clause-question/m-p/640147#M190595</link>
      <description>&lt;P&gt;I have nine diagnosis code attributes (columns) labeled Diag1, Diag2,&amp;nbsp; ..... , Diag9&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have several icd-10 dx_codes that I need to check across 3 years of Medicaid recipient claims&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the c ode starting after the FROM clause&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WHERE Month Between '201701' And '201912'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; And ClaimType Not In ('D')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; And&amp;nbsp; Diag1 - Diag9 In ('B20', 'B9735', ........., '09873')&lt;/P&gt;&lt;P&gt;ORDER By Recipno, Month;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The problem occurs at Diag1- Diag9&amp;nbsp; with the error reading&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;Expression using negation (-) requires numeric types&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried several variants of the Diag1-DIag9 construct but none have solved the issue.&lt;/P&gt;&lt;P&gt;I appreciate your help again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Walt Lierman&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 17:37:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Where-clause-question/m-p/640147#M190595</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2020-04-15T17:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL- Where clause question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Where-clause-question/m-p/640161#M190598</link>
      <description>&lt;P&gt;You can't use variable lists in proc SQL. Try the condition&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And &lt;BR /&gt;whichc(Diag1, 'B20', 'B9735', ........., '09873') +&lt;BR /&gt;whichc(Diag2, 'B20', 'B9735', ........., '09873') +&lt;BR /&gt;whichc(Diag3, 'B20', 'B9735', ........., '09873') +&lt;BR /&gt;whichc(Diag4, 'B20', 'B9735', ........., '09873') +&lt;BR /&gt;whichc(Diag5, 'B20', 'B9735', ........., '09873') +&lt;BR /&gt;whichc(Diag6, 'B20', 'B9735', ........., '09873') +&lt;BR /&gt;whichc(Diag7, 'B20', 'B9735', ........., '09873') +&lt;BR /&gt;whichc(Diag8, 'B20', 'B9735', ........., '09873') +&lt;BR /&gt;whichc(Diag9, 'B20', 'B9735', ........., '09873') &amp;gt; 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which is probably more efficient than a condition involving the OR operator.Diag1 in (...) OR Diag2 in (...) ...&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 18:01:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Where-clause-question/m-p/640161#M190598</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-04-15T18:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL- Where clause question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Where-clause-question/m-p/640164#M190600</link>
      <description>&lt;P&gt;Variable lists do not work in SQL code, only in regular SAS code, that is why it thought you wanted subtraction.&lt;/P&gt;
&lt;P&gt;But even if they did work your syntax will not work.&amp;nbsp; SAS does not have a syntax for test M variables for N values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to list all of the test separately.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE Month between '201701' and '201912'
    and ClaimType Not In ('D')
    and (Diag1 in ('B20', 'B9735', ........., '09873')
      or Diag2 in ('B20', 'B9735', ........., '09873')
   ...
      or Diag9 in ('B20', 'B9735', ........., '09873')
        )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2020 18:02:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Where-clause-question/m-p/640164#M190600</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-15T18:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL- Where clause question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Where-clause-question/m-p/640184#M190609</link>
      <description>Thank you for your help on this.&lt;BR /&gt;Appreciate it very much.</description>
      <pubDate>Wed, 15 Apr 2020 18:38:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Where-clause-question/m-p/640184#M190609</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2020-04-15T18:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL- Where clause question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Where-clause-question/m-p/641611#M191252</link>
      <description>&lt;P&gt;Thank you Tom.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your time and effort and correction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Walt L&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 13:47:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Where-clause-question/m-p/641611#M191252</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2020-04-21T13:47:10Z</dc:date>
    </item>
  </channel>
</rss>

