<?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 using where clause for multiple columns with multiple values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-where-clause-for-multiple-columns-with-multiple/m-p/527446#M143787</link>
    <description>&lt;P&gt;Is the diagnosis code "398.91", as in your introduction, or "39891" in your queries?&lt;/P&gt;</description>
    <pubDate>Tue, 15 Jan 2019 18:56:02 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2019-01-15T18:56:02Z</dc:date>
    <item>
      <title>PROC SQL using where clause for multiple columns with multiple values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-where-clause-for-multiple-columns-with-multiple/m-p/527417#M143778</link>
      <description>&lt;DIV class="lia-message-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;DIV class="lia-message-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;I am executing a query which has multiple columns in where clause which has multiple values. I know that in PROC SQL you can use IN condition to satisfy and get the correct output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FAKE DATA&lt;/P&gt;&lt;P&gt;Question: CHF is defined using the following diagnosis codes:&lt;BR /&gt;398.91, 402.11, 402.91, 404.11, 404.13, 404.91, 404.93 (Codes are in CHARATER form)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.Query: (I merge two tables)&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table BENE_CHF as&lt;BR /&gt;select distinct a.BENE_ID, b.ICD9_DGNS_CD_1, ICD9_DGNS_CD_2, ICD9_DGNS_CD_3, ICD9_DGNS_CD_4, ICD9_DGNS_CD_5,ICD9_DGNS_CD_6, ICD9_DGNS_CD_7, ICD9_DGNS_CD_8,&lt;BR /&gt;LINE_ICD9_DGNS_CD_1,&lt;BR /&gt;LINE_ICD9_DGNS_CD_2,&lt;BR /&gt;LINE_ICD9_DGNS_CD_3,&lt;BR /&gt;LINE_ICD9_DGNS_CD_4,&lt;BR /&gt;LINE_ICD9_DGNS_CD_5,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THIS QUERY IS WORKING&lt;BR /&gt;LINE_ICD9_DGNS_CD_6,&lt;BR /&gt;LINE_ICD9_DGNS_CD_7,&lt;BR /&gt;LINE_ICD9_DGNS_CD_8,&lt;BR /&gt;LINE_ICD9_DGNS_CD_9,&lt;BR /&gt;LINE_ICD9_DGNS_CD_10,&lt;BR /&gt;LINE_ICD9_DGNS_CD_11,&lt;BR /&gt;LINE_ICD9_DGNS_CD_12,&lt;BR /&gt;LINE_ICD9_DGNS_CD_13&lt;BR /&gt;from work.beneficiary_summary_file_2008 as a,&lt;BR /&gt;work.carrier_2008 as b&lt;BR /&gt;where a.BENE_ID = b.BENE_ID;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/***********************************************************************************************************/&lt;/P&gt;&lt;P&gt;Next sept is to sort the data according to ICD codes methioned above.&lt;/P&gt;&lt;P&gt;I tried different quries such as;&lt;/P&gt;&lt;P&gt;1.proc sql;&lt;BR /&gt;select *&lt;BR /&gt;from bene_chf&lt;BR /&gt;where ICD9_DGNS_CD_1 and&lt;BR /&gt;ICD9_DGNS_CD_2 and&lt;BR /&gt;ICD9_DGNS_CD_3 and&lt;BR /&gt;ICD9_DGNS_CD_4 and&lt;BR /&gt;ICD9_DGNS_CD_5 and&lt;BR /&gt;ICD9_DGNS_CD_6 and&lt;BR /&gt;ICD9_DGNS_CD_7 and&lt;BR /&gt;ICD9_DGNS_CD_8 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_1 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_2 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_3 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_4 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_5 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_6 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_7 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_8 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_9 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_10 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_11 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_12 and&lt;BR /&gt;LINE_ICD9_DGNS_CD_13 in ('39891', '40211', '40291', '40411', '40413', '40491', '40493', '42830');&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.proc sql;&lt;BR /&gt;select *&lt;BR /&gt;from bene_chf&lt;BR /&gt;where ICD9_DGNS_CD_1&lt;BR /&gt;&amp;nbsp;in ('39891', '40211', '40291', '40411', '40413', '40491', '40493', '42830') or &amp;nbsp;&lt;BR /&gt;ICD9_DGNS_CD_2&lt;BR /&gt;in ('39891', '40211', '40291', '40411', '40413', '40491', '40493', '42830') or&lt;BR /&gt;ICD9_DGNS_CD_3&lt;BR /&gt;in ('39891', '40211', '40291', '40411', '40413', '40491', '40493', '42830') or&lt;BR /&gt;ICD9_DGNS_CD_4&lt;BR /&gt;in ('39891', '40211', '40291', '40411', '40413', '40491', '40493', '42830') or&lt;BR /&gt;ICD9_DGNS_CD_5&lt;BR /&gt;in ('39891', '40211', '40291', '40411', '40413', '40491', '40493', '42830')&lt;BR /&gt;group by bene_id;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3.where strip(ICD9_DGNS_CD_1) in ('39891', '40211', '40291', '40411', '40413', '40491', '400493', '42830') or&lt;BR /&gt;strip(ICD9_DGNS_CD_2) in ('39891', '40211', '40291', '40411', '40413', '40491', '400493', '42830').........so on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not able to get a right output.&lt;/P&gt;&lt;P&gt;any suggestion or comments are highly appriciated.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 15 Jan 2019 18:21:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-where-clause-for-multiple-columns-with-multiple/m-p/527417#M143778</guid>
      <dc:creator>prjadhav00</dc:creator>
      <dc:date>2019-01-15T18:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL using where clause for multiple columns with multiple values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-where-clause-for-multiple-columns-with-multiple/m-p/527446#M143787</link>
      <description>&lt;P&gt;Is the diagnosis code "398.91", as in your introduction, or "39891" in your queries?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 18:56:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-where-clause-for-multiple-columns-with-multiple/m-p/527446#M143787</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-01-15T18:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL using where clause for multiple columns with multiple values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-where-clause-for-multiple-columns-with-multiple/m-p/527454#M143792</link>
      <description>My mistake diagnosis code does not have any decimal value&lt;BR /&gt;&lt;BR /&gt;'39891' is in right form in queries&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Jan 2019 19:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-where-clause-for-multiple-columns-with-multiple/m-p/527454#M143792</guid>
      <dc:creator>prjadhav00</dc:creator>
      <dc:date>2019-01-15T19:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL using where clause for multiple columns with multiple values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-where-clause-for-multiple-columns-with-multiple/m-p/527465#M143800</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/191254"&gt;@prjadhav00&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;DIV class="lia-message-body"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;DIV class="lia-message-body"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not able to get a right output.&lt;/P&gt;
&lt;P&gt;any suggestion or comments are highly appriciated.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Example input and example of the "right output" are likely needed.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 19:10:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-using-where-clause-for-multiple-columns-with-multiple/m-p/527465#M143800</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-15T19:10:37Z</dc:date>
    </item>
  </channel>
</rss>

