<?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: Removing Trailing Blanks in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Removing-Trailing-Blanks/m-p/108088#M22509</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Dec 2012 16:01:46 GMT</pubDate>
    <dc:creator>robertrao</dc:creator>
    <dc:date>2012-12-26T16:01:46Z</dc:date>
    <item>
      <title>Removing Trailing Blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Trailing-Blanks/m-p/108085#M22506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;At the outset I would like to wish you a Merry Christmas.&lt;/P&gt;&lt;P&gt;Secondly,&lt;/P&gt;&lt;P&gt;I have a variable with codes and description comined under a single variable like shown.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Codes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;111 Diabetes&lt;/P&gt;&lt;P&gt;222 Cancer&lt;/P&gt;&lt;P&gt;333 Diabetes low&lt;/P&gt;&lt;P&gt;444 Diabetes High&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had to seperate the codes from the description. My code is as follows;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data codes;&lt;/P&gt;&lt;P&gt;set Bench;&lt;/P&gt;&lt;P&gt;code2=strip(subsr(code,1,3));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;Even then I get the trailing spaces in code2 variable and its length remains the same as the original variable????&lt;/P&gt;&lt;P&gt;Could you help me remove the spaces?i could not acheive it with the trim either!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Dec 2012 15:40:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Trailing-Blanks/m-p/108085#M22506</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-12-26T15:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Trailing Blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Trailing-Blanks/m-p/108086#M22507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there an issue with blanks or just with the new variables length?&amp;nbsp; If it is the latter, is it corrected if you add a length statement?&amp;nbsp; e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data codes;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set Bench;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length code2 $3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; code2=strip(substr(code,1,3));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Dec 2012 15:49:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Trailing-Blanks/m-p/108086#M22507</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-12-26T15:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Trailing Blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Trailing-Blanks/m-p/108087#M22508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Karun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Scan(), substr(), trim(), strip() and many other character functions do NOT assign length to your new variable, they only inherit the length of the variables they are working on. In your case, "code2" will have the same length as "code" if you don't explicitly assign a length to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;update for your code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input code $&amp;amp;100.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;111 Diabetes&lt;/P&gt;&lt;P&gt;222 Cancer&lt;/P&gt;&lt;P&gt;333 Diabetes low&lt;/P&gt;&lt;P&gt;444 Diabetes High&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length code2 $3;&lt;/P&gt;&lt;P&gt;code2 = left(code);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Dec 2012 15:58:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Trailing-Blanks/m-p/108087#M22508</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-12-26T15:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Trailing Blanks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Trailing-Blanks/m-p/108088#M22509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Dec 2012 16:01:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Trailing-Blanks/m-p/108088#M22509</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2012-12-26T16:01:46Z</dc:date>
    </item>
  </channel>
</rss>

