<?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 Replacing all punctuation in a string with spaces in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Replacing-all-punctuation-in-a-string-with-spaces/m-p/384346#M91760</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a work around that I can use just one tranwrd function to replace all the special charaters in the string. I'm using below code to replace word&amp;nbsp;by word using multiple variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
string='run along&amp;amp;the$wall#mister miller';
newstring1=tranwrd(string,'#',' ');
newstring2=tranwrd(newstring1,'&amp;amp;',' ');
newstring3=tranwrd(newstring2,'$',' ');
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Mon, 31 Jul 2017 16:39:55 GMT</pubDate>
    <dc:creator>ab12nov</dc:creator>
    <dc:date>2017-07-31T16:39:55Z</dc:date>
    <item>
      <title>Replacing all punctuation in a string with spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-all-punctuation-in-a-string-with-spaces/m-p/384346#M91760</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a work around that I can use just one tranwrd function to replace all the special charaters in the string. I'm using below code to replace word&amp;nbsp;by word using multiple variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
string='run along&amp;amp;the$wall#mister miller';
newstring1=tranwrd(string,'#',' ');
newstring2=tranwrd(newstring1,'&amp;amp;',' ');
newstring3=tranwrd(newstring2,'$',' ');
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 16:39:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-all-punctuation-in-a-string-with-spaces/m-p/384346#M91760</guid>
      <dc:creator>ab12nov</dc:creator>
      <dc:date>2017-07-31T16:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing all punctuation in a string with spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-all-punctuation-in-a-string-with-spaces/m-p/384347#M91761</link>
      <description>&lt;P&gt;Try TRANSLATE instead.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 16:41:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-all-punctuation-in-a-string-with-spaces/m-p/384347#M91761</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-31T16:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing all punctuation in a string with spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-all-punctuation-in-a-string-with-spaces/m-p/384348#M91762</link>
      <description>&lt;P&gt;you can use prxchange too&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
string='run along&amp;amp;the$wall#mister miller';
string1= prxchange('s/&amp;amp;|\$|#/ /', -1, string);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Jul 2017 16:50:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-all-punctuation-in-a-string-with-spaces/m-p/384348#M91762</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-07-31T16:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing all punctuation in a string with spaces</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Replacing-all-punctuation-in-a-string-with-spaces/m-p/384350#M91764</link>
      <description>&lt;P&gt;Combine the translate function with the compress function. Use the modifiers for the compress function to tell it which characters you DON'T&amp;nbsp;want to turn into spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  string='run along&amp;amp;the$wall#mister miller';
  new_string=translate(string,' ',compress(string,,'ad'));
  put string $char100. / new_string $char100. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;run along&amp;amp;the$wall#mister miller
run along the wall mister miller
&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Jul 2017 16:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Replacing-all-punctuation-in-a-string-with-spaces/m-p/384350#M91764</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-31T16:53:00Z</dc:date>
    </item>
  </channel>
</rss>

