<?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 Can SAS filter multiple possible LIKE conditions, without an OR? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Can-SAS-filter-multiple-possible-LIKE-conditions-without-an-OR/m-p/542208#M74160</link>
    <description>&lt;P&gt;I have a query like so:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table test_query as
    select *
    from lib.dataset
    where something = 1
        and (description contains ("ABC")
          or description contains ("DEF")
          or description contains ("GHI")
          or description contains ("JKL")
          or description contains ("MNO")
          or description contains ("PQR"))
    ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there a way to do something like "description LIKE IN ('%ABC%', '%DEF%', '%GHI%', ...)' that would avoid costly ORs within the query? Or something more efficient that I'm not thinking of?&lt;/P&gt;</description>
    <pubDate>Mon, 11 Mar 2019 20:36:13 GMT</pubDate>
    <dc:creator>paulkaefer</dc:creator>
    <dc:date>2019-03-11T20:36:13Z</dc:date>
    <item>
      <title>Can SAS filter multiple possible LIKE conditions, without an OR?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Can-SAS-filter-multiple-possible-LIKE-conditions-without-an-OR/m-p/542208#M74160</link>
      <description>&lt;P&gt;I have a query like so:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table test_query as
    select *
    from lib.dataset
    where something = 1
        and (description contains ("ABC")
          or description contains ("DEF")
          or description contains ("GHI")
          or description contains ("JKL")
          or description contains ("MNO")
          or description contains ("PQR"))
    ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there a way to do something like "description LIKE IN ('%ABC%', '%DEF%', '%GHI%', ...)' that would avoid costly ORs within the query? Or something more efficient that I'm not thinking of?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 20:36:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Can-SAS-filter-multiple-possible-LIKE-conditions-without-an-OR/m-p/542208#M74160</guid>
      <dc:creator>paulkaefer</dc:creator>
      <dc:date>2019-03-11T20:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can SAS filter multiple possible LIKE conditions, without an OR?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Can-SAS-filter-multiple-possible-LIKE-conditions-without-an-OR/m-p/542211#M74161</link>
      <description>&lt;P&gt;How about PRXMATCH() ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=sashelp.class;
where prxmatch('/B|M/i',name);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs    Name       Sex    Age    Height    Weight

  3    Barbara     F      13     65.3        98
  6    James       M      12     57.3        83
 14    Mary        F      15     66.5       112
 16    Robert      M      12     64.8       128
 18    Thomas      M      11     57.5        85
 19    William     M      15     66.5       112
&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Mar 2019 20:54:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Can-SAS-filter-multiple-possible-LIKE-conditions-without-an-OR/m-p/542211#M74161</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-11T20:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can SAS filter multiple possible LIKE conditions, without an OR?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Can-SAS-filter-multiple-possible-LIKE-conditions-without-an-OR/m-p/542487#M74171</link>
      <description>&lt;P&gt;Thanks, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;! I can't believe I didn't think of regexes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interestingly, the performance didn't seem much better, a sign that maybe the original filters aren't so bad.&lt;/P&gt;
&lt;P&gt;But this definitely cleans-up the code quite a bit &amp;amp; gives more flexibility for automated query construction.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 16:38:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Can-SAS-filter-multiple-possible-LIKE-conditions-without-an-OR/m-p/542487#M74171</guid>
      <dc:creator>paulkaefer</dc:creator>
      <dc:date>2019-03-12T16:38:46Z</dc:date>
    </item>
  </channel>
</rss>

