<?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: Substring in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Substring/m-p/201139#M266814</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;a='428552LCOR42';&lt;/P&gt;&lt;P&gt;b=compress(a,'LC');&lt;/P&gt;&lt;P&gt;put b=;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Jul 2015 14:39:59 GMT</pubDate>
    <dc:creator>Loko</dc:creator>
    <dc:date>2015-07-13T14:39:59Z</dc:date>
    <item>
      <title>Substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring/m-p/201138#M266813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to know how to create a substring please.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The value I have is &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt;428552LCOR42&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I need to remove the 'LC' (7&amp;amp;8) to show as below, any ideas please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt;428552OR42&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 14:37:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring/m-p/201138#M266813</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2015-07-13T14:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: Substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring/m-p/201139#M266814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;a='428552LCOR42';&lt;/P&gt;&lt;P&gt;b=compress(a,'LC');&lt;/P&gt;&lt;P&gt;put b=;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 14:39:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring/m-p/201139#M266814</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2015-07-13T14:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring/m-p/201140#M266815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or: b=tranwrd(a,'LC','');&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 14:41:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring/m-p/201140#M266815</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-07-13T14:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring/m-p/201141#M266816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not knowing how dynamic you need the substring to be when removing it, but if there is just one instance of "LC" in your field value, and that's all you are looking to remove, I would suggest the compress() function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;newvar=strip(compress(oldvar,"LC"));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will eliminate any "L" or "C" in your original variable, and remove any leading or trailing blanks with the strip() function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 14:42:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring/m-p/201141#M266816</guid>
      <dc:creator>dcruik</dc:creator>
      <dc:date>2015-07-13T14:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: Substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring/m-p/201142#M266817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to remove only L&amp;amp;C in the String the following code will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Sample;&lt;/P&gt;&lt;P&gt;Have='428552LCOR42';&lt;/P&gt;&lt;P&gt;Want=compress(Have,'LC');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF you want to remove the 7th and 8th characters from the entire variable then &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Want;&lt;/P&gt;&lt;P&gt;set Have;&lt;/P&gt;&lt;P&gt;wantVar=strip(substr(haveVar,1,6)||substr(haveVar,9));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 14:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring/m-p/201142#M266817</guid>
      <dc:creator>MadhuKorni</dc:creator>
      <dc:date>2015-07-13T14:42:44Z</dc:date>
    </item>
  </channel>
</rss>

