<?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 can I evaluate a variable to create other if the if function does not allow the like operato in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343357#M78817</link>
    <description>&lt;P&gt;the findc function allows you to both find if a string contains one or more of the variables in a list, as well as ignore case (if desired). e.g.:&lt;/P&gt;
&lt;PRE&gt;data want;&lt;BR /&gt; informat string $23.;&lt;BR /&gt; input string &amp;amp;;&lt;BR /&gt; if findc(string, 'abc', "i") then&lt;BR /&gt; want='Contains A, B or C';&lt;BR /&gt; datalines;&lt;BR /&gt;Microsoft Office Visio&lt;BR /&gt;Microsoft Office Word&lt;BR /&gt;Adobe Photoshop&lt;BR /&gt;Adobe PhotoshopPro&lt;BR /&gt;Internet Explorer&lt;BR /&gt;;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2017 15:52:25 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-03-22T15:52:25Z</dc:date>
    <item>
      <title>How can I evaluate a variable to create other if the if function does not allow the like operator?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343103#M78734</link>
      <description>&lt;P&gt;&lt;SPAN&gt;How can I evaluate a variable to create another if the if function does not allow the like operator&lt;/SPAN&gt;?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example is easy if var is numeric, like:&lt;/P&gt;&lt;P&gt;IF VAR1 = 0 THEN VAR2 = 'A';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But if I need to evaluate something inside&amp;nbsp;string of characters how can it be?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;some like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;IF VAR1 LIKE "%A%" THEN VAR2 = "&lt;SPAN class="short_text"&gt;CONTAINS LETTER A"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="short_text"&gt;What operator can I replace to LIKE?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 22:42:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343103#M78734</guid>
      <dc:creator>Angel_Saenz</dc:creator>
      <dc:date>2017-03-21T22:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can I evaluate a variable to create other if the if function does not allow the like operato</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343121#M78741</link>
      <description>&lt;P&gt;Either the INDEX or FINDC functions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 00:45:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343121#M78741</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-22T00:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I evaluate a variable to create other if the if function does not allow the like operato</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343131#M78745</link>
      <description>&lt;P&gt;alternatively we could try the perl regular expression like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if prxmatch('m/[a]/i',VAR1) then VAR2="&lt;SPAN&gt;&lt;SPAN class="short_text"&gt;CONTAINS LETTER A&lt;/SPAN&gt;&lt;/SPAN&gt;";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Mar 2017 01:05:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343131#M78745</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-03-22T01:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can I evaluate a variable to create other if the if function does not allow the like operato</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343307#M78809</link>
      <description>&lt;P&gt;thank you Art, and do you know how can I do it like a evaluate a list?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text"&gt;&lt;SPAN&gt;I know this does not work&lt;/SPAN&gt;&lt;/SPAN&gt; but is only an example:&lt;/P&gt;&lt;P&gt;IF VAR1 IN ('%A%','%B%','%C%') THEN VAR2&amp;nbsp;&amp;nbsp;= '&lt;SPAN class="short_text"&gt;CONTAINS LETTERS A B or C'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use this works:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;IF INDEX(VAR1,'A') THEN VAR2 = '&lt;SPAN class="short_text"&gt;CONTAINS LETTERS A B or C'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;IF INDEX(VAR1,'B') THEN VAR2 = '&lt;SPAN class="short_text"&gt;CONTAINS LETTERS A B or C'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;IF INDEX(VAR1,'C') THEN VAR2 = '&lt;SPAN class="short_text"&gt;CONTAINS LETTERS A B or C'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="short_text"&gt;But is it possible to simplify it?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="short_text"&gt;I simplified like this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="short_text"&gt;IF INDEX(VAR1,'A')&amp;nbsp;or INDEX(VAR1,'B') or INDEX(VAR1,'C') THEN VAR2 = 'CONTAINS LETTERS A B or C'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="short_text"&gt;but is there another way tah you know more shorten? some like:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="short_text"&gt;IF INDEX(VAR1,'A','B','C') THEN VAR2 = 'CONTAINS LETTERS A B or C'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="short_text"&gt;Thanks&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 15:07:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343307#M78809</guid>
      <dc:creator>Angel_Saenz</dc:creator>
      <dc:date>2017-03-22T15:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can I evaluate a variable to create other if the if function does not allow the like operato</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343337#M78814</link>
      <description>&lt;P&gt;Please try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if prxmatch('m/[abc]/i',VAR1) then VAR2="CONTAINS LETTER A or B or C";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Mar 2017 15:32:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343337#M78814</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-03-22T15:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can I evaluate a variable to create other if the if function does not allow the like operato</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343357#M78817</link>
      <description>&lt;P&gt;the findc function allows you to both find if a string contains one or more of the variables in a list, as well as ignore case (if desired). e.g.:&lt;/P&gt;
&lt;PRE&gt;data want;&lt;BR /&gt; informat string $23.;&lt;BR /&gt; input string &amp;amp;;&lt;BR /&gt; if findc(string, 'abc', "i") then&lt;BR /&gt; want='Contains A, B or C';&lt;BR /&gt; datalines;&lt;BR /&gt;Microsoft Office Visio&lt;BR /&gt;Microsoft Office Word&lt;BR /&gt;Adobe Photoshop&lt;BR /&gt;Adobe PhotoshopPro&lt;BR /&gt;Internet Explorer&lt;BR /&gt;;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 15:52:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-evaluate-a-variable-to-create-other-if-the-if-function/m-p/343357#M78817</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-22T15:52:25Z</dc:date>
    </item>
  </channel>
</rss>

