<?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: Combining conditions in where clause in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540908#M149269</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/240770"&gt;@Ranjeeta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;data test ;&lt;BR /&gt;285 set CR_CATHD;&lt;BR /&gt;286 array t(3) Cath_SSPCIIND Cath_ScheduledPCIIND Cath_StagedPCIIND;&lt;BR /&gt;287 if 'Y' in t and FYEAR =2016 and RemovalReasonCD = 'PS' and AcceptanceHCPNumber=953&lt;BR /&gt;288 then count+1;&lt;BR /&gt;289 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 433888 observations read from the data set WORK.CR_CATHD.&lt;BR /&gt;NOTE: The data set WORK.TEST has 433888 observations and 241 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 5.42 seconds&lt;BR /&gt;cpu time 1.29 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What could be the reason that none of the filters are getting applied e.g.. FYear =2016 or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What makes you think none of the filters are applied?&lt;/P&gt;
&lt;P&gt;The example here does not have any OR comparisons so the only values kept are the ones where all of the values match the IF condition. Though 'Y' in t is problematic. The SAS IN operator requires a fixed list of values. if you want to search a string value for Y anywhere in a variable the correct approach would be: if index(t,'Y') &amp;gt; 0. The index function returns the position number of the found value in the string variable or returns 0 if not found.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Mar 2019 19:53:26 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-03-06T19:53:26Z</dc:date>
    <item>
      <title>Combining conditions in where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540890#M149261</link>
      <description>&lt;P&gt;data test ;&lt;BR /&gt;set CR_CATHD;&lt;BR /&gt;where (Cath_SSPCIIND = 'Y' or Cath_ScheduledPCIIND = 'Y' or Cath_StagedPCIIND = 'Y')and FYEAR =2016 and RemovalReasonCD = 'PS' and AcceptanceHCPNumber=1302 ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello Can someone advise How I would write the step abve&amp;nbsp; or if the step above is correct in order to achieve the following:&lt;/P&gt;&lt;P&gt;I want the count of cases where either of the conditions in the parentheses is Y and the conditions outside the parentheses are satisfied.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 19:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540890#M149261</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2019-03-06T19:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Combining conditions in where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540895#M149263</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test ;
set CR_CATHD;
array t(*) Cath_SSPCIIND Cath_ScheduledPCIIND Cath_StagedPCIIND;
if 'Y' in t and FYEAR =2016 and RemovalReasonCD = 'PS' and AcceptanceHCPNumber=1302
then count+1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Mar 2019 19:25:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540895#M149263</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-03-06T19:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Combining conditions in where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540896#M149264</link>
      <description>Thankyou !!</description>
      <pubDate>Wed, 06 Mar 2019 19:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540896#M149264</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2019-03-06T19:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Combining conditions in where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540903#M149267</link>
      <description>&lt;P&gt;data test ;&lt;BR /&gt;285 set CR_CATHD;&lt;BR /&gt;286 array t(3) Cath_SSPCIIND Cath_ScheduledPCIIND Cath_StagedPCIIND;&lt;BR /&gt;287 if 'Y' in t and FYEAR =2016 and RemovalReasonCD = 'PS' and AcceptanceHCPNumber=953&lt;BR /&gt;288 then count+1;&lt;BR /&gt;289 run;&lt;/P&gt;&lt;P&gt;NOTE: There were 433888 observations read from the data set WORK.CR_CATHD.&lt;BR /&gt;NOTE: The data set WORK.TEST has 433888 observations and 241 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 5.42 seconds&lt;BR /&gt;cpu time 1.29 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What could be the reason that none of the filters are getting applied e.g.. FYear =2016 or&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 19:44:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540903#M149267</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2019-03-06T19:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Combining conditions in where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540908#M149269</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/240770"&gt;@Ranjeeta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;data test ;&lt;BR /&gt;285 set CR_CATHD;&lt;BR /&gt;286 array t(3) Cath_SSPCIIND Cath_ScheduledPCIIND Cath_StagedPCIIND;&lt;BR /&gt;287 if 'Y' in t and FYEAR =2016 and RemovalReasonCD = 'PS' and AcceptanceHCPNumber=953&lt;BR /&gt;288 then count+1;&lt;BR /&gt;289 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 433888 observations read from the data set WORK.CR_CATHD.&lt;BR /&gt;NOTE: The data set WORK.TEST has 433888 observations and 241 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 5.42 seconds&lt;BR /&gt;cpu time 1.29 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What could be the reason that none of the filters are getting applied e.g.. FYear =2016 or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What makes you think none of the filters are applied?&lt;/P&gt;
&lt;P&gt;The example here does not have any OR comparisons so the only values kept are the ones where all of the values match the IF condition. Though 'Y' in t is problematic. The SAS IN operator requires a fixed list of values. if you want to search a string value for Y anywhere in a variable the correct approach would be: if index(t,'Y') &amp;gt; 0. The index function returns the position number of the found value in the string variable or returns 0 if not found.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 19:53:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540908#M149269</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-06T19:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Combining conditions in where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540909#M149270</link>
      <description>&lt;P&gt;Ok, I am basically not filtering. I am basically counting the number of cases that satisfy the condition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do take a look at the count.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well , I think this should help you better as you really seem to want filtered records&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test ;
set CR_CATHD;
array t(*) Cath_SSPCIIND Cath_ScheduledPCIIND Cath_StagedPCIIND;
if 'Y' in t and FYEAR =2016 and RemovalReasonCD = 'PS' and AcceptanceHCPNumber=1302;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thats a subsetting if&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Initially I assumed you wanted a count&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 19:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-conditions-in-where-clause/m-p/540909#M149270</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-03-06T19:54:32Z</dc:date>
    </item>
  </channel>
</rss>

