<?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 Special Characters when exporting to XLSX in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Removing-Special-Characters-when-exporting-to-XLSX/m-p/357553#M83957</link>
    <description>&lt;P&gt;If you want to remove CR and LF from strings in SAS then use the COMPRESS() function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have;
  QUESTION_TEXT = compress(QUESTION_TEXT,'0D0A'x);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to replace them with single characters you can use the TRANSLATE() function. For example to replace them with spaces you could use.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have;
  QUESTION_TEXT = translate(QUESTION_TEXT,'  ','0D0A'x);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 10 May 2017 16:20:14 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2017-05-10T16:20:14Z</dc:date>
    <item>
      <title>Removing Special Characters when exporting to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Special-Characters-when-exporting-to-XLSX/m-p/357547#M83953</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have a DATA table that needs exporting to Excel but it seems to have Return characters etc within it and distorts the export.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the "univeral" script that we use in SQL &amp;amp; need to find something similar to run in BASE SAS 9.4 to remove the characters from the data before exporting it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SELECT QUESTION_TEXT&lt;/P&gt;&lt;P&gt;,REPLACE(REPLACE(QUESTION_TEXT,CHAR(10),''),CHAR(13),'')&lt;/P&gt;&lt;P&gt;FROM BI_Staging.dbo.XXFRGSAM_QUESTION_LIBRARY&lt;/P&gt;&lt;P&gt;WHERE (QUESTION_TEXT LIKE '%'+CHAR(10)+'%')&lt;/P&gt;&lt;P&gt;OR (QUESTION_TEXT LIKE '%'+CHAR(13)+'%')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help please.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 16:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Special-Characters-when-exporting-to-XLSX/m-p/357547#M83953</guid>
      <dc:creator>ColleenCB</dc:creator>
      <dc:date>2017-05-10T16:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Special Characters when exporting to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Special-Characters-when-exporting-to-XLSX/m-p/357553#M83957</link>
      <description>&lt;P&gt;If you want to remove CR and LF from strings in SAS then use the COMPRESS() function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have;
  QUESTION_TEXT = compress(QUESTION_TEXT,'0D0A'x);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to replace them with single characters you can use the TRANSLATE() function. For example to replace them with spaces you could use.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have;
  QUESTION_TEXT = translate(QUESTION_TEXT,'  ','0D0A'x);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 May 2017 16:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Special-Characters-when-exporting-to-XLSX/m-p/357553#M83957</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-05-10T16:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Removing Special Characters when exporting to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-Special-Characters-when-exporting-to-XLSX/m-p/357555#M83959</link>
      <description>&lt;P&gt;The 2 lines should be one but the problem is&amp;nbsp;that there is a carriage return in the original data is a problem and should be removed.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 16:20:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-Special-Characters-when-exporting-to-XLSX/m-p/357555#M83959</guid>
      <dc:creator>ColleenCB</dc:creator>
      <dc:date>2017-05-10T16:20:35Z</dc:date>
    </item>
  </channel>
</rss>

