<?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: SAS strip function doesn't work in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/m-p/434771#M107929</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/26530"&gt;@cm292&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;data test;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;char=strip('ALTEPLASE INJECTION 2 MG &amp;nbsp;');&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After running the above program, the two trailing spaces aren't trimmed. Please instruct.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What happens is this:&lt;/P&gt;
&lt;P&gt;When SAS encounters such a character assignment, and the length of the receiving variable has not been defined yet, then the length of the source is used, and since character variables are always of fixed length and padded with blanks, the result is identical to the initial string.&lt;/P&gt;
&lt;P&gt;Strip in such a case only makes sense when you need to remove leading blanks.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Feb 2018 06:54:36 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-02-07T06:54:36Z</dc:date>
    <item>
      <title>SAS strip function doesn't work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/m-p/434757#M107927</link>
      <description>&lt;P&gt;data test;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;char=strip('ALTEPLASE INJECTION 2 MG &amp;nbsp;');&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After running the above program, the two trailing spaces aren't trimmed. Please instruct.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 04:12:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/m-p/434757#M107927</guid>
      <dc:creator>cm292</dc:creator>
      <dc:date>2018-02-07T04:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS strip function doesn't work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/m-p/434760#M107928</link>
      <description>&lt;P&gt;The STRIP function is only relevant if you are adding text to the right. Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
     char=strip('ALTEPLASE INJECTION 2 MG  ') !! 'Extra text';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you don't add anything then SAS pads character variables with blanks up to the length the CHAR field is defined as when storing in the dataset TEST.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 04:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/m-p/434760#M107928</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-02-07T04:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS strip function doesn't work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/m-p/434771#M107929</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/26530"&gt;@cm292&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;data test;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;char=strip('ALTEPLASE INJECTION 2 MG &amp;nbsp;');&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After running the above program, the two trailing spaces aren't trimmed. Please instruct.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What happens is this:&lt;/P&gt;
&lt;P&gt;When SAS encounters such a character assignment, and the length of the receiving variable has not been defined yet, then the length of the source is used, and since character variables are always of fixed length and padded with blanks, the result is identical to the initial string.&lt;/P&gt;
&lt;P&gt;Strip in such a case only makes sense when you need to remove leading blanks.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 06:54:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/m-p/434771#M107929</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-02-07T06:54:36Z</dc:date>
    </item>
  </channel>
</rss>

