<?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 not like in if statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-not-like-in-if-statement/m-p/825936#M326231</link>
    <description>&lt;P&gt;It a data step LIKE , as you intend to use it, is only available with WHERE, not if.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a data step you can use other functions to identify the presence of a sequence of characters as part of the values such as INDEX or FIND. If you have more complex pattern then PRXMATCH perhaps.&lt;/P&gt;
&lt;P&gt;The Index and Find functions return the position of found value or 0 if not found.&lt;/P&gt;
&lt;P&gt;Notice the use of datalines to provide values and the different results for Find with and without the 'i', case insensitive, comparison.&lt;/P&gt;
&lt;PRE&gt;data ex;
   input name :$15.;
   /* checks for presence of ex anywhere in name*/
   if find(name,'ex')=0 then rank=1;
   else rank=2;
   /* presence of ex case insensitive*/
   if find(name,'ex','i')=0 then rank2=1;
   else rank2=2;

datalines;
kumar(ex)
shiva
jonhEXfg
mareXbo
PATExxxx
;&lt;/PRE&gt;</description>
    <pubDate>Thu, 28 Jul 2022 14:27:15 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-07-28T14:27:15Z</dc:date>
    <item>
      <title>how to use not like in if statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-not-like-in-if-statement/m-p/825866#M326196</link>
      <description>&lt;P&gt;data ex;&lt;BR /&gt;name='kumar(ex)' ;&lt;BR /&gt;output;&lt;BR /&gt;name='shiva' ;&lt;BR /&gt;output;&lt;BR /&gt;if name ^=:'(ex)' then rank=1;&lt;BR /&gt;else if name =:'(ex)' then rank=2;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how to use like and not like operations in if statement&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 09:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-not-like-in-if-statement/m-p/825866#M326196</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2022-07-28T09:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to use not like in if statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-not-like-in-if-statement/m-p/825868#M326198</link>
      <description>The syntax is fine, but the logic is faulty.  RANK will be missing because the program outputs observations before assigning a value to RANK.</description>
      <pubDate>Thu, 28 Jul 2022 09:27:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-not-like-in-if-statement/m-p/825868#M326198</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-07-28T09:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to use not like in if statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-use-not-like-in-if-statement/m-p/825936#M326231</link>
      <description>&lt;P&gt;It a data step LIKE , as you intend to use it, is only available with WHERE, not if.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a data step you can use other functions to identify the presence of a sequence of characters as part of the values such as INDEX or FIND. If you have more complex pattern then PRXMATCH perhaps.&lt;/P&gt;
&lt;P&gt;The Index and Find functions return the position of found value or 0 if not found.&lt;/P&gt;
&lt;P&gt;Notice the use of datalines to provide values and the different results for Find with and without the 'i', case insensitive, comparison.&lt;/P&gt;
&lt;PRE&gt;data ex;
   input name :$15.;
   /* checks for presence of ex anywhere in name*/
   if find(name,'ex')=0 then rank=1;
   else rank=2;
   /* presence of ex case insensitive*/
   if find(name,'ex','i')=0 then rank2=1;
   else rank2=2;

datalines;
kumar(ex)
shiva
jonhEXfg
mareXbo
PATExxxx
;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 14:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-use-not-like-in-if-statement/m-p/825936#M326231</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-28T14:27:15Z</dc:date>
    </item>
  </channel>
</rss>

