<?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 Strip Function in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Strip-Function/m-p/584057#M17859</link>
    <description>&lt;P&gt;I am trying to use the strip function to reduce the length of a character variable from 255 characters to 3 characters (the longest value has 3 characters).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data lengths;&lt;BR /&gt;set courtdata;&lt;/P&gt;&lt;P&gt;new =&amp;nbsp; strip (ADJCLASS);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have read the thread here:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/td-p/434757" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/td-p/434757&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it is unclear from the previous thread how the problem is actually fixed. I am ultimately trying to convert this variable from character to numeric, but I think I will need to strip it first.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;</description>
    <pubDate>Mon, 26 Aug 2019 20:14:24 GMT</pubDate>
    <dc:creator>jlutz</dc:creator>
    <dc:date>2019-08-26T20:14:24Z</dc:date>
    <item>
      <title>Strip Function</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Strip-Function/m-p/584057#M17859</link>
      <description>&lt;P&gt;I am trying to use the strip function to reduce the length of a character variable from 255 characters to 3 characters (the longest value has 3 characters).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data lengths;&lt;BR /&gt;set courtdata;&lt;/P&gt;&lt;P&gt;new =&amp;nbsp; strip (ADJCLASS);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have read the thread here:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/td-p/434757" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/td-p/434757&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it is unclear from the previous thread how the problem is actually fixed. I am ultimately trying to convert this variable from character to numeric, but I think I will need to strip it first.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:14:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Strip-Function/m-p/584057#M17859</guid>
      <dc:creator>jlutz</dc:creator>
      <dc:date>2019-08-26T20:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Strip Function</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Strip-Function/m-p/584061#M17860</link>
      <description>&lt;P&gt;Are you asking for&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
length var_char $255;/*Your length set at compile time-also when reading another dataset*/
var_char='     999          ';
var_num=input(strip(var_char),3.);
put var_char= var_num=;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Aug 2019 20:29:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Strip-Function/m-p/584061#M17860</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-26T20:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Strip Function</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Strip-Function/m-p/584064#M17861</link>
      <description>Unless you change the variable length, SAS will add spaces by default to take up the extra room. You need to change the length of the variable for this to be an effective solution.</description>
      <pubDate>Mon, 26 Aug 2019 20:35:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Strip-Function/m-p/584064#M17861</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-26T20:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Strip Function</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Strip-Function/m-p/585318#M17893</link>
      <description>Thank you!</description>
      <pubDate>Fri, 30 Aug 2019 18:16:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Strip-Function/m-p/585318#M17893</guid>
      <dc:creator>jlutz</dc:creator>
      <dc:date>2019-08-30T18:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Strip Function</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Strip-Function/m-p/585338#M17894</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/282968"&gt;@jlutz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to use the strip function to reduce the length of a character variable from 255 characters to 3 characters (the longest value has 3 characters).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data lengths;&lt;BR /&gt;set courtdata;&lt;/P&gt;
&lt;P&gt;new =&amp;nbsp; strip (ADJCLASS);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have read the thread here:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/td-p/434757" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/SAS-strip-function-doesn-t-work/td-p/434757&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it is unclear from the previous thread how the problem is actually fixed. I am ultimately trying to convert this variable from character to numeric, but I think I will need to strip it first.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There is no need to do anything to the original value, unless it has LEADING spaces.&amp;nbsp;You want to use the LEFT() function in case the value is not in the first 32 bytes of the string. There is no need to use the STRIP() function since trailing spaces don't matter, but you could use it in place of the LEFT() function.&lt;/P&gt;
&lt;P&gt;The maximum number of characters the normal informat for converting text strings into numbers can handle is 32.&amp;nbsp; So if your actual data has a max of only 3 characters, even though the variable has room for more, then you should not have many issues&amp;nbsp;(although the number of decimal digits a number can actually store is more like 15 digits).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data lengths;
  set courtdata;
  new =&amp;nbsp; input(left(ADJCLASS),32.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 19:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Strip-Function/m-p/585338#M17894</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-30T19:27:15Z</dc:date>
    </item>
  </channel>
</rss>

