<?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: How to Compress Certain String ( Additional char to create white space) i in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Compress-Certain-String-Additional-char-to-create-white/m-p/875014#M345734</link>
    <description>&lt;P&gt;One way:&lt;/P&gt;
&lt;PRE&gt;data chk;
have = "55 (43.8%)(*ESC*)R'\par '92";
want = compress(tranwrd(have,"(*ESC*)R'\par '",''));
run;&lt;/PRE&gt;
&lt;P&gt;The Tranwrd function replaces a whole matching string with another, in this case empty string (space) and Compress removes the spaces. TRANSLATE does a character by character replacement and would not be desired because if you replace the ( or the ) then the parentheses around the percentage also get replaced (I guess you found that out).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That \par would be RAW RTF codes, likely involving a paragraph (this is a guess, do a google search for "RTF Codes" for details) somewhere. The "*ESC*" part places an escape to allow the SAS ODS generator to send a raw rtf formatting code to a word processor that can handle them.&lt;/P&gt;</description>
    <pubDate>Wed, 10 May 2023 16:20:14 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-05-10T16:20:14Z</dc:date>
    <item>
      <title>How to Compress Certain String ( Additional char to create white space) i</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Compress-Certain-String-Additional-char-to-create-white/m-p/875005#M345733</link>
      <description>&lt;P&gt;I have a dataset that will be sent to ods rtf output. I want to compare the dataset with mine, Some variables have characters that are used to create white space or 'ESC" for reporting.&amp;nbsp; I am not sure how to remove them. I tried to compress and translate functions to manipulate. but I am having difficulty removing them."(*ESC*)R'\par '" is the extra string that I want to remove. When I used to compress it removing breakers (parenthesis) for others. How I can achieve this? Thank you for your suggestions. Also what exactly does this String&amp;nbsp; (*ESC*)R'\par ') do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data chk;
have = "55 (43.8%)(*ESC*)R'\par '92";
want = "55(43.8%)92";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 15:56:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Compress-Certain-String-Additional-char-to-create-white/m-p/875005#M345733</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2023-05-10T15:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compress Certain String ( Additional char to create white space) i</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Compress-Certain-String-Additional-char-to-create-white/m-p/875014#M345734</link>
      <description>&lt;P&gt;One way:&lt;/P&gt;
&lt;PRE&gt;data chk;
have = "55 (43.8%)(*ESC*)R'\par '92";
want = compress(tranwrd(have,"(*ESC*)R'\par '",''));
run;&lt;/PRE&gt;
&lt;P&gt;The Tranwrd function replaces a whole matching string with another, in this case empty string (space) and Compress removes the spaces. TRANSLATE does a character by character replacement and would not be desired because if you replace the ( or the ) then the parentheses around the percentage also get replaced (I guess you found that out).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That \par would be RAW RTF codes, likely involving a paragraph (this is a guess, do a google search for "RTF Codes" for details) somewhere. The "*ESC*" part places an escape to allow the SAS ODS generator to send a raw rtf formatting code to a word processor that can handle them.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 16:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Compress-Certain-String-Additional-char-to-create-white/m-p/875014#M345734</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-05-10T16:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to Compress Certain String ( Additional char to create white space) i</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Compress-Certain-String-Additional-char-to-create-white/m-p/875080#M345753</link>
      <description>&lt;P&gt;It worked. Thank you very much.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 20:34:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Compress-Certain-String-Additional-char-to-create-white/m-p/875080#M345753</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2023-05-10T20:34:26Z</dc:date>
    </item>
  </channel>
</rss>

