<?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: using INDEX to search for multiple strings in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-INDEX-to-search-for-multiple-strings/m-p/76226#M16461</link>
    <description>That is what I'm after, but this code did not work.</description>
    <pubDate>Wed, 04 Mar 2009 16:19:39 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-03-04T16:19:39Z</dc:date>
    <item>
      <title>using INDEX to search for multiple strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-INDEX-to-search-for-multiple-strings/m-p/76224#M16459</link>
      <description>I have a large dataset with the variable 'species' that consists of the scientific name in the form of the two word 'Genus species' and would like to assign some of these animals into a more general 'name' variable by using only the genus portion of the scientific name. I have tried to use the INDEX function but cannot figure out how to search for multiple excerpts--an example:&lt;BR /&gt;
&lt;BR /&gt;
if index(species,'Genus1'||'Genus2') then name = 'new name';&lt;BR /&gt;
else name = species;&lt;BR /&gt;
&lt;BR /&gt;
this code does not generate an error but also does resolves to the 'else' statement.&lt;BR /&gt;
INDEXC does not appear to be an option because it does not retain the character pattern.&lt;BR /&gt;
&lt;BR /&gt;
Does anyone have any suggestions?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Wed, 04 Mar 2009 15:51:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-INDEX-to-search-for-multiple-strings/m-p/76224#M16459</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-03-04T15:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: using INDEX to search for multiple strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-INDEX-to-search-for-multiple-strings/m-p/76225#M16460</link>
      <description>I'm not sure I totally understand what you're after but if the first word is always the genus then could you not use:&lt;BR /&gt;
&lt;BR /&gt;
if scan(species,1) in ('Genus1' 'Genus2');</description>
      <pubDate>Wed, 04 Mar 2009 16:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-INDEX-to-search-for-multiple-strings/m-p/76225#M16460</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-03-04T16:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: using INDEX to search for multiple strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-INDEX-to-search-for-multiple-strings/m-p/76226#M16461</link>
      <description>That is what I'm after, but this code did not work.</description>
      <pubDate>Wed, 04 Mar 2009 16:19:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-INDEX-to-search-for-multiple-strings/m-p/76226#M16461</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-03-04T16:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: using INDEX to search for multiple strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-INDEX-to-search-for-multiple-strings/m-p/76227#M16462</link>
      <description>How did it not work? DId you get an error?&lt;BR /&gt;
&lt;BR /&gt;
Have you managed to work it the way you want?</description>
      <pubDate>Wed, 04 Mar 2009 16:33:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-INDEX-to-search-for-multiple-strings/m-p/76227#M16462</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-03-04T16:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: using INDEX to search for multiple strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-INDEX-to-search-for-multiple-strings/m-p/76228#M16463</link>
      <description>Please excuse me, but It works now that I separated each 'Genus' with a comma.  Problem solved!  Thanks a lot for your help.</description>
      <pubDate>Wed, 04 Mar 2009 16:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-INDEX-to-search-for-multiple-strings/m-p/76228#M16463</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-03-04T16:42:35Z</dc:date>
    </item>
  </channel>
</rss>

