<?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 TRIM and STRIP function not removing white space for character variable, PROC SQL? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/TRIM-and-STRIP-function-not-removing-white-space-for-character/m-p/786267#M251009</link>
    <description>&lt;P&gt;Hello SAS Community:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset with a character variable, I'll call it "char_var".&amp;nbsp; If I explore one of "char_var"'s observations, the value for "char_var" appears as 'hello', and when I display it with PROC PRINT, it looks just like 'hello' with no trailing or leading blanks.&amp;nbsp; When I apply the LENGTH function to the "char_var" variable however and assign that result to a variable I named "len", the value of "len" is 10.&amp;nbsp; Even when I apply the TRIM and STRIP functions, separately each to "char_var", first, before applying the LENGTH function, and assigning the results to separate variables "len_trim", and "len_strip", respectively, the value stored in each of these variables is also 10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess there is some kind of non-printing character that is not getting removed? The reason I need to get just the 'printable' characters isolated is because the "char_var" column is supposed to serve as a "foreign key"&amp;nbsp; for another table (data set), and since I can't reduce the value of the "char_var" down to the length of just the printable characters, which would be 5, I can't match the value correctly with the 'hello' value in the joining table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using the NOTPRINT and INDEX, FIND functions as well to see if I could locate these 'invisible' characters, but I didn't have any success.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on how I can strip these extra characters from the "char_var" variables' value to reduce its length to 5 (the length of the printable characters)? Or perhaps another strategy to be able to link the tables on this variable, despite the mismatching lengths?&lt;/P&gt;</description>
    <pubDate>Thu, 16 Dec 2021 06:50:45 GMT</pubDate>
    <dc:creator>AlexCarey</dc:creator>
    <dc:date>2021-12-16T06:50:45Z</dc:date>
    <item>
      <title>TRIM and STRIP function not removing white space for character variable, PROC SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TRIM-and-STRIP-function-not-removing-white-space-for-character/m-p/786267#M251009</link>
      <description>&lt;P&gt;Hello SAS Community:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset with a character variable, I'll call it "char_var".&amp;nbsp; If I explore one of "char_var"'s observations, the value for "char_var" appears as 'hello', and when I display it with PROC PRINT, it looks just like 'hello' with no trailing or leading blanks.&amp;nbsp; When I apply the LENGTH function to the "char_var" variable however and assign that result to a variable I named "len", the value of "len" is 10.&amp;nbsp; Even when I apply the TRIM and STRIP functions, separately each to "char_var", first, before applying the LENGTH function, and assigning the results to separate variables "len_trim", and "len_strip", respectively, the value stored in each of these variables is also 10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess there is some kind of non-printing character that is not getting removed? The reason I need to get just the 'printable' characters isolated is because the "char_var" column is supposed to serve as a "foreign key"&amp;nbsp; for another table (data set), and since I can't reduce the value of the "char_var" down to the length of just the printable characters, which would be 5, I can't match the value correctly with the 'hello' value in the joining table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using the NOTPRINT and INDEX, FIND functions as well to see if I could locate these 'invisible' characters, but I didn't have any success.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on how I can strip these extra characters from the "char_var" variables' value to reduce its length to 5 (the length of the printable characters)? Or perhaps another strategy to be able to link the tables on this variable, despite the mismatching lengths?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 06:50:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TRIM-and-STRIP-function-not-removing-white-space-for-character/m-p/786267#M251009</guid>
      <dc:creator>AlexCarey</dc:creator>
      <dc:date>2021-12-16T06:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: TRIM and STRIP function not removing white space for character variable, PROC SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TRIM-and-STRIP-function-not-removing-white-space-for-character/m-p/786268#M251010</link>
      <description>&lt;P&gt;Please have a look at &lt;A href="https://communities.sas.com/t5/SAS-Programming/TRIM-and-STRIP-function-not-removing-white-space-for-character/m-p/785955" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/TRIM-and-STRIP-function-not-removing-white-space-for-character/m-p/785955&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 07:20:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TRIM-and-STRIP-function-not-removing-white-space-for-character/m-p/786268#M251010</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-12-16T07:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: TRIM and STRIP function not removing white space for character variable, PROC SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TRIM-and-STRIP-function-not-removing-white-space-for-character/m-p/786269#M251011</link>
      <description>Print the variable using the $hex20. format  and you will see what's in there.</description>
      <pubDate>Thu, 16 Dec 2021 07:20:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TRIM-and-STRIP-function-not-removing-white-space-for-character/m-p/786269#M251011</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-12-16T07:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: TRIM and STRIP function not removing white space for character variable, PROC SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/TRIM-and-STRIP-function-not-removing-white-space-for-character/m-p/786275#M251014</link>
      <description>&lt;P&gt;It's probably not a white space. One way to remove non-printable characters is to use the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/lefunctionsref/n0fcshr0ir3h73n1b845c4aq58hz.htm" target="_self"&gt;compress&lt;/A&gt;&amp;nbsp;function with the &lt;STRONG&gt;wk&lt;/STRONG&gt; or the&amp;nbsp;&lt;STRONG&gt;s&lt;/STRONG&gt; modifier.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 09:35:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/TRIM-and-STRIP-function-not-removing-white-space-for-character/m-p/786275#M251014</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-12-16T09:35:29Z</dc:date>
    </item>
  </channel>
</rss>

