<?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: remove special hidden ZWSP and NBSP from char column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/remove-special-hidden-ZWSP-and-NBSP-from-char-column/m-p/961793#M374929</link>
    <description>&lt;P&gt;I assume your data and SAS session are using UTF-8 encoding to be able actual represent a zero-width space character.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.fileformat.info/info/unicode/char/200b/index.htm" target="_blank" rel="noopener"&gt;https://www.fileformat.info/info/unicode/char/200b/index.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to REMOVE those characters completely?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name_new = kcompress(name,'C2A0E2808B'x); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or replace them with spaces?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name_new = ktranslate(name,'  ','C2A0E2808B'x);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or perhaps remove the ZWSP and replace the NBSP?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name_new = kcompress(ktranslate(name,' ','C2A0'x),'E2808B'x);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your SAS session is using a single byte encoding, like WLATIN1, then you will need to use TRANWRD() to replace the characters.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name_new = tranwrd(tranwrd(name,'C2A0'x,' '),'E2808B'x,' ');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or to remove the ZWSP use TRANSTRN.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name_new = transtrn(tranwrd(name,'C2A0'x,' '),'E2808B'x,trimn(' '));&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 13 Mar 2025 15:02:07 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2025-03-13T15:02:07Z</dc:date>
    <item>
      <title>remove special hidden ZWSP and NBSP from char column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-special-hidden-ZWSP-and-NBSP-from-char-column/m-p/961782#M374926</link>
      <description>&lt;P&gt;I import a excel file with proc import into a SAS table and than put that data into a teradata table.&lt;/P&gt;
&lt;P&gt;I get a error when I load the data into the teradata table. Bad character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We checked the excel file and in certain rows we saw hidden non printable characters (ZWSP en NBSP).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are trying to filter those characters out with the following code.&lt;/P&gt;
&lt;P&gt;DATA work.filtered;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; SET work.unfiltered;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; name_new = PRXCHANGE('s/\x{200B}//',-1, name); /* does not work to filter out ZWSP */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; name_new = PRZCHANGE('s/\&amp;amp;zwsp;//',-1, name);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* does not work to filter out ZWSP */&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I doing wrong or is there a other solution within SAS.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Mar 2025 13:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-special-hidden-ZWSP-and-NBSP-from-char-column/m-p/961782#M374926</guid>
      <dc:creator>Richardvan_tHoff</dc:creator>
      <dc:date>2025-03-13T13:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: remove special hidden ZWSP and NBSP from char column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-special-hidden-ZWSP-and-NBSP-from-char-column/m-p/961788#M374928</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider using the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/lefunctionsref/3.2/n0fcshr0ir3h73n1b845c4aq58hz.htm" target="_blank" rel="noopener"&gt;compress()&lt;/A&gt;&amp;nbsp; function, using 'kw' as the modifiers to keep only printable characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data filtered;
  set unfiltered;
  name_new = compress(name,,'kw');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: Added code sample.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Mar 2025 13:41:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-special-hidden-ZWSP-and-NBSP-from-char-column/m-p/961788#M374928</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2025-03-13T13:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: remove special hidden ZWSP and NBSP from char column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-special-hidden-ZWSP-and-NBSP-from-char-column/m-p/961793#M374929</link>
      <description>&lt;P&gt;I assume your data and SAS session are using UTF-8 encoding to be able actual represent a zero-width space character.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.fileformat.info/info/unicode/char/200b/index.htm" target="_blank" rel="noopener"&gt;https://www.fileformat.info/info/unicode/char/200b/index.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to REMOVE those characters completely?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name_new = kcompress(name,'C2A0E2808B'x); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or replace them with spaces?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name_new = ktranslate(name,'  ','C2A0E2808B'x);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or perhaps remove the ZWSP and replace the NBSP?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name_new = kcompress(ktranslate(name,' ','C2A0'x),'E2808B'x);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your SAS session is using a single byte encoding, like WLATIN1, then you will need to use TRANWRD() to replace the characters.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name_new = tranwrd(tranwrd(name,'C2A0'x,' '),'E2808B'x,' ');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or to remove the ZWSP use TRANSTRN.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;name_new = transtrn(tranwrd(name,'C2A0'x,' '),'E2808B'x,trimn(' '));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Mar 2025 15:02:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-special-hidden-ZWSP-and-NBSP-from-char-column/m-p/961793#M374929</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-03-13T15:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: remove special hidden ZWSP and NBSP from char column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-special-hidden-ZWSP-and-NBSP-from-char-column/m-p/962041#M375016</link>
      <description>Both Solutions work. Thank you both.</description>
      <pubDate>Tue, 18 Mar 2025 07:37:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-special-hidden-ZWSP-and-NBSP-from-char-column/m-p/962041#M375016</guid>
      <dc:creator>Richardvan_tHoff</dc:creator>
      <dc:date>2025-03-18T07:37:01Z</dc:date>
    </item>
  </channel>
</rss>

