<?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 How to Search for Characters after Special characters in a string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Search-for-Characters-after-Special-characters-in-a/m-p/858023#M339011</link>
    <description>&lt;P&gt;Hi, I have a string that I'm trying to get only a part of.&amp;nbsp; The format of the original string is like this: '0000 - Stoney Lynn' and I want the function to output 'Stoney Lynn' with no trailing spaces or proceeding spaces.&amp;nbsp; There is not a standard amount of spaces between the dash: '0000-Stoney Lynn'.&amp;nbsp; Also sometimes the dash appears to be a longer dash not recognized as '-'.&amp;nbsp; This is why I think a function looking for characters after any special character may work better and then trim any extra spaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Heres what I have tried so far:&amp;nbsp;subjectname=trim(compress((substr(subjectid,5)),'-'))&lt;/P&gt;&lt;P&gt;But some of the output comes back with a dash still and the spaces dont trim correctly.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Feb 2023 13:54:05 GMT</pubDate>
    <dc:creator>jmmedina252</dc:creator>
    <dc:date>2023-02-09T13:54:05Z</dc:date>
    <item>
      <title>How to Search for Characters after Special characters in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Search-for-Characters-after-Special-characters-in-a/m-p/858023#M339011</link>
      <description>&lt;P&gt;Hi, I have a string that I'm trying to get only a part of.&amp;nbsp; The format of the original string is like this: '0000 - Stoney Lynn' and I want the function to output 'Stoney Lynn' with no trailing spaces or proceeding spaces.&amp;nbsp; There is not a standard amount of spaces between the dash: '0000-Stoney Lynn'.&amp;nbsp; Also sometimes the dash appears to be a longer dash not recognized as '-'.&amp;nbsp; This is why I think a function looking for characters after any special character may work better and then trim any extra spaces.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Heres what I have tried so far:&amp;nbsp;subjectname=trim(compress((substr(subjectid,5)),'-'))&lt;/P&gt;&lt;P&gt;But some of the output comes back with a dash still and the spaces dont trim correctly.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 13:54:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Search-for-Characters-after-Special-characters-in-a/m-p/858023#M339011</guid>
      <dc:creator>jmmedina252</dc:creator>
      <dc:date>2023-02-09T13:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to Search for Characters after Special characters in a string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Search-for-Characters-after-Special-characters-in-a/m-p/858025#M339013</link>
      <description>&lt;P&gt;You can use the SCAN function to extract text after a dash. If it is a regular dash, you can use the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;subjectname=strip(scan(subjectid,2,'-'));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If it is a long dash, you can use the hex representation:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;subjectname=strip(scan(subjectid,2,'96'x));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can look at a variable in hex using a format:&lt;/P&gt;
&lt;P&gt;format subjectid $50.;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 14:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Search-for-Characters-after-Special-characters-in-a/m-p/858025#M339013</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2023-02-09T14:07:32Z</dc:date>
    </item>
  </channel>
</rss>

