<?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 CONDITIONAL SELECTION OF COMBINATIONS OF THREE VARIABLES USING ARRAY in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/CONDITIONAL-SELECTION-OF-COMBINATIONS-OF-THREE-VARIABLES-USING/m-p/368509#M87898</link>
    <description>&lt;P&gt;&amp;nbsp;I have to select patients who&amp;nbsp;has specific combinations of conditions as following:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;1. patients with both P2 and the Pa;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;OR&lt;/P&gt;&lt;P&gt;2. patients with both the P3 and the Pa;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Patients must have P2 and P3&amp;nbsp;with the Pa to be eligible. Simply put: P2+Pa, P3+Pa, P2+P3+Pa combinations are acceptable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data combinations; set have;
 array diagnosis[*] condition othercondition_1-othercondition_24;
  do i = 1 to dim(diagnosis);
   if diagnosis[i] in ('P2','P3') then x=1; 
   if diagnosis[i] in ('Pa')      then y=1;
   if x=1 and y=1 then output;
  end;
  drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, resulting data "combinations" has an information for single subject (row) repeated 20 times. Very strange. Any idea why that happened?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOG:&amp;nbsp;&lt;/P&gt;&lt;P&gt;There were 95560 observations read from the data set WORK.HAVE.&lt;BR /&gt;NOTE: The data set WORK.COMBINATIONS has 20 observations and 66 variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using SAS 9.4.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Jun 2017 22:15:46 GMT</pubDate>
    <dc:creator>Cruise</dc:creator>
    <dc:date>2017-06-19T22:15:46Z</dc:date>
    <item>
      <title>CONDITIONAL SELECTION OF COMBINATIONS OF THREE VARIABLES USING ARRAY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CONDITIONAL-SELECTION-OF-COMBINATIONS-OF-THREE-VARIABLES-USING/m-p/368509#M87898</link>
      <description>&lt;P&gt;&amp;nbsp;I have to select patients who&amp;nbsp;has specific combinations of conditions as following:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;1. patients with both P2 and the Pa;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;OR&lt;/P&gt;&lt;P&gt;2. patients with both the P3 and the Pa;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Patients must have P2 and P3&amp;nbsp;with the Pa to be eligible. Simply put: P2+Pa, P3+Pa, P2+P3+Pa combinations are acceptable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data combinations; set have;
 array diagnosis[*] condition othercondition_1-othercondition_24;
  do i = 1 to dim(diagnosis);
   if diagnosis[i] in ('P2','P3') then x=1; 
   if diagnosis[i] in ('Pa')      then y=1;
   if x=1 and y=1 then output;
  end;
  drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, resulting data "combinations" has an information for single subject (row) repeated 20 times. Very strange. Any idea why that happened?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOG:&amp;nbsp;&lt;/P&gt;&lt;P&gt;There were 95560 observations read from the data set WORK.HAVE.&lt;BR /&gt;NOTE: The data set WORK.COMBINATIONS has 20 observations and 66 variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using SAS 9.4.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 22:15:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CONDITIONAL-SELECTION-OF-COMBINATIONS-OF-THREE-VARIABLES-USING/m-p/368509#M87898</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2017-06-19T22:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: CONDITIONAL SELECTION OF COMBINATIONS OF THREE VARIABLES USING ARRAY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CONDITIONAL-SELECTION-OF-COMBINATIONS-OF-THREE-VARIABLES-USING/m-p/368511#M87899</link>
      <description>&lt;P&gt;Use WHICHC() to create flags for each of your three variables and then use those variables to do your conditioning.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 22:24:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CONDITIONAL-SELECTION-OF-COMBINATIONS-OF-THREE-VARIABLES-USING/m-p/368511#M87899</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-19T22:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: CONDITIONAL SELECTION OF COMBINATIONS OF THREE VARIABLES USING ARRAY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CONDITIONAL-SELECTION-OF-COMBINATIONS-OF-THREE-VARIABLES-USING/m-p/368516#M87900</link>
      <description>&lt;P&gt;A simple solution: &amp;nbsp;move the OUTPUT statement. &amp;nbsp;Instead of coding it inside the DO loop, move it to after the END statement.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 22:38:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CONDITIONAL-SELECTION-OF-COMBINATIONS-OF-THREE-VARIABLES-USING/m-p/368516#M87900</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-06-19T22:38:04Z</dc:date>
    </item>
  </channel>
</rss>

