<?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: How to  use the like operator in sas data step? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-the-like-operator-in-sas-data-step/m-p/585283#M14293</link>
    <description>&lt;P&gt;Either modify your program logic so that you can use a WHERE statement instead of an IF statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where (x like '%xxx') or (x like '%yyy') ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use some other method to test the values in your IF statement.&lt;/P&gt;
&lt;P&gt;Perhaps you can use PRXMATCH() function instead?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Editor's Note:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As Reeza noted, the like function is not available for IF conditions, but&amp;nbsp; rather for WHERE statements. Also including Ksharp's example of PRXMATCH() syntax:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if prxmatch('/APPROVED$|APPROVAL PENDING$|SEND TO SALES$/i',strip(lead_status));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jul 2022 15:40:54 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-07-07T15:40:54Z</dc:date>
    <item>
      <title>How to  use the like operator in sas data step?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-the-like-operator-in-sas-data-step/m-p/585281#M14292</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a query where i am using the&amp;nbsp; if statement and i need to find the string matching the variable given.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;if&lt;/SPAN&gt;&lt;SPAN class="s2"&gt; lead_status in ( &lt;/SPAN&gt;'%APPROVED'&lt;SPAN class="s2"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;'%APPROVAL PENDING'&lt;SPAN class="s2"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;'%SEND TO SALES'&lt;SPAN class="s2"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s3"&gt;''&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;)&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;And this not reading or working...!&lt;/P&gt;&lt;P class="p2"&gt;This is in a data step!.&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;Appreciate your help and genuine support&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 16:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-the-like-operator-in-sas-data-step/m-p/585281#M14292</guid>
      <dc:creator>codyV</dc:creator>
      <dc:date>2019-08-30T16:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to  use the like operator in sas data step?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-the-like-operator-in-sas-data-step/m-p/585283#M14293</link>
      <description>&lt;P&gt;Either modify your program logic so that you can use a WHERE statement instead of an IF statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where (x like '%xxx') or (x like '%yyy') ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use some other method to test the values in your IF statement.&lt;/P&gt;
&lt;P&gt;Perhaps you can use PRXMATCH() function instead?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Editor's Note:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As Reeza noted, the like function is not available for IF conditions, but&amp;nbsp; rather for WHERE statements. Also including Ksharp's example of PRXMATCH() syntax:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if prxmatch('/APPROVED$|APPROVAL PENDING$|SEND TO SALES$/i',strip(lead_status));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 15:40:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-the-like-operator-in-sas-data-step/m-p/585283#M14293</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-07T15:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to  use the like operator in sas data step?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-the-like-operator-in-sas-data-step/m-p/585289#M14295</link>
      <description>How can i use it in a if statement ? even if i use a where!</description>
      <pubDate>Fri, 30 Aug 2019 16:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-the-like-operator-in-sas-data-step/m-p/585289#M14295</guid>
      <dc:creator>codyV</dc:creator>
      <dc:date>2019-08-30T16:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to  use the like operator in sas data step?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-the-like-operator-in-sas-data-step/m-p/585308#M14304</link>
      <description>LIKE is not a valid function in an IF statement. You cannot use that function in an IF statement. You can use it in a WHERE statement. &lt;BR /&gt;&lt;BR /&gt;Similar functions that you could use in an IF statement are FIND(), FINDW(), INDEX/W() and Regex.</description>
      <pubDate>Fri, 30 Aug 2019 17:54:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-the-like-operator-in-sas-data-step/m-p/585308#M14304</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-30T17:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to  use the like operator in sas data step?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-the-like-operator-in-sas-data-step/m-p/585406#M14320</link>
      <description>&lt;PRE&gt;if prxmatch('/APPROVED$|APPROVAL PENDING$|SEND TO SALES$/i',strip(lead_status));
&lt;/PRE&gt;</description>
      <pubDate>Sat, 31 Aug 2019 11:49:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-the-like-operator-in-sas-data-step/m-p/585406#M14320</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-08-31T11:49:21Z</dc:date>
    </item>
  </channel>
</rss>

