<?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: Extracting words from a string after a specific character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extracting-words-from-a-string-after-a-specific-character/m-p/533382#M146227</link>
    <description>Use INDEX() to find the first tilda and then use that number in SUBSTR(). &lt;BR /&gt;Double check the order of t&lt;BR /&gt;&lt;BR /&gt;cm = substr(comment, index(comment, '~') +1);</description>
    <pubDate>Wed, 06 Feb 2019 20:26:15 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-02-06T20:26:15Z</dc:date>
    <item>
      <title>Extracting words from a string after a specific character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-words-from-a-string-after-a-specific-character/m-p/533379#M146226</link>
      <description>&lt;P&gt;Hi, I have a variable called "comment" that contains a string of words that are separated by '~'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;comment&lt;/P&gt;&lt;P&gt;text text text text ~ text text&lt;/P&gt;&lt;P&gt;text text&amp;nbsp;text&amp;nbsp;text&amp;nbsp;text ~ text&amp;nbsp;text&amp;nbsp;text ~text&amp;nbsp;text&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to extract the text after the first ~ without losing the text behind the second or third or fourth ~ etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using this code:&lt;/P&gt;&lt;P&gt;cm=scan(comment,1,"~");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it only extracts the text after the first ~ and then stops once it reaches the second ~&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is much appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 20:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-words-from-a-string-after-a-specific-character/m-p/533379#M146226</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2019-02-06T20:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting words from a string after a specific character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-words-from-a-string-after-a-specific-character/m-p/533382#M146227</link>
      <description>Use INDEX() to find the first tilda and then use that number in SUBSTR(). &lt;BR /&gt;Double check the order of t&lt;BR /&gt;&lt;BR /&gt;cm = substr(comment, index(comment, '~') +1);</description>
      <pubDate>Wed, 06 Feb 2019 20:26:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-words-from-a-string-after-a-specific-character/m-p/533382#M146227</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-06T20:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting words from a string after a specific character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-words-from-a-string-after-a-specific-character/m-p/533386#M146228</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the quick response. Out of curiosity, what does the +1 signify?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 20:34:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-words-from-a-string-after-a-specific-character/m-p/533386#M146228</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2019-02-06T20:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting words from a string after a specific character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-words-from-a-string-after-a-specific-character/m-p/533391#M146229</link>
      <description>INDEX would find the ~, so if you substring from that it includes the ~, +1 gives you the position after the first ~.</description>
      <pubDate>Wed, 06 Feb 2019 20:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-words-from-a-string-after-a-specific-character/m-p/533391#M146229</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-06T20:50:18Z</dc:date>
    </item>
  </channel>
</rss>

