<?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: Extract specie word from string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extract-specie-word-from-string/m-p/345224#M79390</link>
    <description>&lt;P&gt;You can use the find function to do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  set want;
  if find(comment,"storm","i")&amp;gt;0 then output = "Storm";
  else if find(comment,"theft","i")&amp;gt;0 then output = "Theft";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This assumes you will only ever find one or the other. If it is possible to have both, you would have to check for both simultaneously and concatenate your results.&lt;/P&gt;</description>
    <pubDate>Wed, 29 Mar 2017 02:05:21 GMT</pubDate>
    <dc:creator>JoshB</dc:creator>
    <dc:date>2017-03-29T02:05:21Z</dc:date>
    <item>
      <title>Extract specie word from string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-specie-word-from-string/m-p/345222#M79389</link>
      <description>Hi I have a table with a comment box I need to extract key words from comment box Theft. Or Storm&lt;BR /&gt;The data looks like this&lt;BR /&gt;&lt;BR /&gt;Id. Comment&lt;BR /&gt;1A. GL THE BOAT STORM&lt;BR /&gt;2A. SUNSHINE&lt;BR /&gt;3A. STORM IN THE CITY&lt;BR /&gt;4A. THEFT. IN THE JUNGLE&lt;BR /&gt;5A. RAINY DAY&lt;BR /&gt;6A. THEFT&lt;BR /&gt;&lt;BR /&gt;Output&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Id. Comment. Output&lt;BR /&gt;1A. GL THE BOAT STORM. Storm&lt;BR /&gt;2A. SUNSHINE&lt;BR /&gt;3A. STORM IN THE CITY. Storm&lt;BR /&gt;4A. THEFT. IN THE JUNGLE. Theft&lt;BR /&gt;5A. RAINY DAY&lt;BR /&gt;6A. THEFT. Theft</description>
      <pubDate>Wed, 29 Mar 2017 01:59:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-specie-word-from-string/m-p/345222#M79389</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-03-29T01:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Extract specie word from string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-specie-word-from-string/m-p/345224#M79390</link>
      <description>&lt;P&gt;You can use the find function to do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  set want;
  if find(comment,"storm","i")&amp;gt;0 then output = "Storm";
  else if find(comment,"theft","i")&amp;gt;0 then output = "Theft";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This assumes you will only ever find one or the other. If it is possible to have both, you would have to check for both simultaneously and concatenate your results.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 02:05:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-specie-word-from-string/m-p/345224#M79390</guid>
      <dc:creator>JoshB</dc:creator>
      <dc:date>2017-03-29T02:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extract specie word from string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-specie-word-from-string/m-p/345256#M79404</link>
      <description>I will test it's one or the other ... thanks for response</description>
      <pubDate>Wed, 29 Mar 2017 04:38:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-specie-word-from-string/m-p/345256#M79404</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-03-29T04:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extract specie word from string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-specie-word-from-string/m-p/345260#M79406</link>
      <description>&lt;P&gt;The IFC function can also be used to consolidate.&amp;nbsp; In this case i choose to look for either or both.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Id $ @5 Comment $30.;
datalines;
1A. GL THE BOAT STORM
2A. SUNSHINE
3A. STORM IN THE CITY
4A. THEFT. IN THE JUNGLE
5A. RAINY DAY
6A. THEFT
7A. THEFT IN A STORM
run;
data want;
   set have;
   output=catx(',',ifc(index(comment,'STORM'),'storm',' '),ifc(index(comment,'THEFT'),'theft',' '));&lt;BR /&gt;   run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Mar 2017 05:40:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-specie-word-from-string/m-p/345260#M79406</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2017-03-29T05:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extract specie word from string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-specie-word-from-string/m-p/345267#M79409</link>
      <description>&lt;P&gt;An issue to consider: &amp;nbsp;do you want the exact word only, or variations such as THEFTS, RAINSTORM, STORMY ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on your answer, you might switch from FIND to FINDW.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 06:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-specie-word-from-string/m-p/345267#M79409</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-29T06:41:29Z</dc:date>
    </item>
  </channel>
</rss>

