<?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: where clause multiple column with multiple values in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/where-clause-multiple-column-with-multiple-values/m-p/527209#M2225</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;Hello Reeza,&lt;BR /&gt;&lt;BR /&gt;Thanks for your suggestions. I tried the query that you provided but it's&lt;BR /&gt;not giving me the specific DGNS_CD which I am looking for. Could you&lt;BR /&gt;provide me with any other query related to this?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Post the code you tried. I only posted a partial snippet so it depends on how you completed the query. Please include the log as well.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Jan 2019 04:31:54 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-01-15T04:31:54Z</dc:date>
    <item>
      <title>where clause multiple column with multiple values</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/where-clause-multiple-column-with-multiple-values/m-p/527199#M2221</link>
      <description>&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;Not able to get a right output.&lt;/P&gt;&lt;P&gt;any suggestion or comments are highly appriciated.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 02:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/where-clause-multiple-column-with-multiple-values/m-p/527199#M2221</guid>
      <dc:creator>prjadhav00</dc:creator>
      <dc:date>2019-01-15T02:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: where clause multiple column with multiple values</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/where-clause-multiple-column-with-multiple-values/m-p/527200#M2222</link>
      <description>&lt;P&gt;Data steps work better for this because Arrays allow you to loop through all the variables with a loop. SQL isn't a good solution. If you must use SQL a macro is what you want. &lt;BR /&gt;&lt;BR /&gt;Your code as posted is not correct, it would need to be:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where ICD9_DGNS_CD_1 in ('39891', '40211', '40291', '40411', '40413', '40491', '40493', '42830') or ICD9_DGNS_CD_2 in ('39891', '40211', '40291', '40411', '40413', '40491', '40493', '42830') .....
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that this wouldn't be a SORT though, it's a filter. If you need to sort the codes, you'll have to explain, but if you're trying to sort within a specific row for example, I'm not even sure SQL can do that easily. Again, this is trivial in a data step.&amp;nbsp;&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/191254"&gt;@prjadhav00&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&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;Not able to get a right output.&lt;/P&gt;
&lt;P&gt;any suggestion or comments are highly appriciated.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 02:38:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/where-clause-multiple-column-with-multiple-values/m-p/527200#M2222</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-15T02:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: where clause multiple column with multiple values</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/where-clause-multiple-column-with-multiple-values/m-p/527203#M2223</link>
      <description>&lt;P&gt;It's possible you need to use SQL in your first step.&amp;nbsp; That depends on where the data resides.&amp;nbsp; But once the first step is complete, the second step could easily use a DATA step instead of SQL:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set bene_chf;
array codes {21} ICD9_DGNS_CD_1 - ICD9_DGNS_CD_8
LINE_ICD9_DGNS_CD_1 - LINE_ICD9_DGNS_CD_13;
do k=1 to 21;
   if codes{k} in ('39891', '40211', '40291', '40411', '40413', '40491', '400493', '42830') then do;
      output;
      delete;
end;
drop k;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since the original logic was not working, it's not 100% sure that this does exactly what you want.&amp;nbsp; But it uses good tools for the job, and it should be easy to tweak it if needed to get what you want.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 03:14:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/where-clause-multiple-column-with-multiple-values/m-p/527203#M2223</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-01-15T03:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: where clause multiple column with multiple values</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/where-clause-multiple-column-with-multiple-values/m-p/527206#M2224</link>
      <description>Hello Reeza,&lt;BR /&gt;&lt;BR /&gt;Thanks for your suggestions. I tried the query that you provided but it's&lt;BR /&gt;not giving me the specific DGNS_CD which I am looking for. Could you&lt;BR /&gt;provide me with any other query related to this?&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Jan 2019 04:17:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/where-clause-multiple-column-with-multiple-values/m-p/527206#M2224</guid>
      <dc:creator>prjadhav00</dc:creator>
      <dc:date>2019-01-15T04:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: where clause multiple column with multiple values</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/where-clause-multiple-column-with-multiple-values/m-p/527209#M2225</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;Hello Reeza,&lt;BR /&gt;&lt;BR /&gt;Thanks for your suggestions. I tried the query that you provided but it's&lt;BR /&gt;not giving me the specific DGNS_CD which I am looking for. Could you&lt;BR /&gt;provide me with any other query related to this?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Post the code you tried. I only posted a partial snippet so it depends on how you completed the query. Please include the log as well.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 04:31:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/where-clause-multiple-column-with-multiple-values/m-p/527209#M2225</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-15T04:31:54Z</dc:date>
    </item>
  </channel>
</rss>

