<?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: Remove leading characters if they are equal to something specified in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-leading-characters-if-they-are-equal-to-something/m-p/851523#M336572</link>
    <description>compress(Actual, 'US')</description>
    <pubDate>Thu, 29 Dec 2022 13:19:45 GMT</pubDate>
    <dc:creator>SasStatistics</dc:creator>
    <dc:date>2022-12-29T13:19:45Z</dc:date>
    <item>
      <title>Remove leading characters if they are equal to something specified</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-leading-characters-if-they-are-equal-to-something/m-p/851519#M336569</link>
      <description>&lt;P&gt;Assume I have the following data stored in a SAS table:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;TABLE width="128"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;Actual&amp;nbsp;&lt;/TD&gt;
&lt;TD width="64"&gt;Desired&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG&gt;US1234&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD&gt;1234&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;13&lt;/TD&gt;
&lt;TD&gt;13&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;14567&lt;/TD&gt;
&lt;TD&gt;14567&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG&gt;US3345&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD&gt;3345&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;What I would like to do is to check each row, if the first two letters are "US" then I would like to remove those letters. If the first two letters are not "US" I want to keep the row as it is.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Any idea on how to do this?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2022 12:59:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-leading-characters-if-they-are-equal-to-something/m-p/851519#M336569</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2022-12-29T12:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: Remove leading characters if they are equal to something specified</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-leading-characters-if-they-are-equal-to-something/m-p/851521#M336570</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if actual=:'US' then desired=substr(actual,3);
else desired=actual;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Dec 2022 13:14:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-leading-characters-if-they-are-equal-to-something/m-p/851521#M336570</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-29T13:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Remove leading characters if they are equal to something specified</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-leading-characters-if-they-are-equal-to-something/m-p/851523#M336572</link>
      <description>compress(Actual, 'US')</description>
      <pubDate>Thu, 29 Dec 2022 13:19:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-leading-characters-if-they-are-equal-to-something/m-p/851523#M336572</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2022-12-29T13:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Remove leading characters if they are equal to something specified</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-leading-characters-if-they-are-equal-to-something/m-p/851530#M336577</link>
      <description>&lt;P&gt;Maybe COMPRESS works with your data as well as the solution I provided, but COMPRESS will do things to your data that you didn't ask for, such as remove US from anywhere in the string (you didn't ask for that, you asked only for beginning of the string) and it will remove U from anywhere and it will remove S from anywhere. Again, this may work fine on your data, but I point this out for anyone else reading along who may have different data.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2022 14:52:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-leading-characters-if-they-are-equal-to-something/m-p/851530#M336577</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-29T14:52:42Z</dc:date>
    </item>
  </channel>
</rss>

