<?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: INDEXC in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/INDEXC/m-p/264507#M51885</link>
    <description>&lt;P&gt;Yes, function indexc() searchs for one single character in the string, where index() searchs for the whole text. &amp;nbsp;You can compress your code somewhat, if &amp;lt;&amp;gt; is looking for a binary 1 or 0 result, so index() or findw() (which i show below) will return 0 if not present, so 0 result, and anything is positive and considered true (also, please dont code all in capitals, it makes reading it very hard):&lt;/P&gt;
&lt;PRE&gt;data test;
  input name $50.;
datalines;
DREFT ESTATES LTD
POTTERSLANE LTD
;
run;

data for_sure unsure;
  set test;
  if findw(name,"GOVERNMENT") or findw(name,"COLLEGE") then output for_sure;
  else output unsure;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Apr 2016 08:58:09 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-04-18T08:58:09Z</dc:date>
    <item>
      <title>INDEXC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEXC/m-p/264401#M51848</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not getting expected results when using INDEXC (please see code below). I would expect all records in the dataset UnSure rather than in For_Sure -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA TEST;&lt;BR /&gt;INPUT Name $50.;&lt;BR /&gt;INFILE DATALINES;&lt;BR /&gt;DATALINES;&lt;BR /&gt;DREFT ESTATES LTD&lt;BR /&gt;POTTERSLANE LTD&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;DATA For_Sure UnSure;&lt;BR /&gt;SET TEST;&lt;BR /&gt;IF indexc(Name, "GOVERNMENT") &amp;gt; 0&lt;BR /&gt;OR indexc(Name, "COLLEGE") &amp;gt; 0 then OUTPUT For_Sure;&lt;BR /&gt;ELSE&amp;nbsp; OUTPUT UnSure;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help will be greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;SK&lt;/P&gt;</description>
      <pubDate>Sun, 17 Apr 2016 08:14:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEXC/m-p/264401#M51848</guid>
      <dc:creator>Siddharth123</dc:creator>
      <dc:date>2016-04-17T08:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: INDEXC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEXC/m-p/264404#M51849</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I figured out that I need to use INDEX rather than INDEXC to solve this problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SK&lt;/P&gt;</description>
      <pubDate>Sun, 17 Apr 2016 08:51:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEXC/m-p/264404#M51849</guid>
      <dc:creator>Siddharth123</dc:creator>
      <dc:date>2016-04-17T08:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: INDEXC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INDEXC/m-p/264507#M51885</link>
      <description>&lt;P&gt;Yes, function indexc() searchs for one single character in the string, where index() searchs for the whole text. &amp;nbsp;You can compress your code somewhat, if &amp;lt;&amp;gt; is looking for a binary 1 or 0 result, so index() or findw() (which i show below) will return 0 if not present, so 0 result, and anything is positive and considered true (also, please dont code all in capitals, it makes reading it very hard):&lt;/P&gt;
&lt;PRE&gt;data test;
  input name $50.;
datalines;
DREFT ESTATES LTD
POTTERSLANE LTD
;
run;

data for_sure unsure;
  set test;
  if findw(name,"GOVERNMENT") or findw(name,"COLLEGE") then output for_sure;
  else output unsure;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 08:58:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INDEXC/m-p/264507#M51885</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-18T08:58:09Z</dc:date>
    </item>
  </channel>
</rss>

