<?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 replace special symbol by space in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565134#M158613</link>
    <description>&lt;P&gt;When you say 'Special Symbols', do you simply mean&amp;nbsp;&lt;SPAN&gt;*,&amp;nbsp;@, &amp;amp;, # or?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2019 07:48:28 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-06-11T07:48:28Z</dc:date>
    <item>
      <title>How to replace special symbol by space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565129#M158610</link>
      <description>Data have;&lt;BR /&gt;String1='aaaaa*bbbb*ddddddd@jjjjjj';&lt;BR /&gt;Output;&lt;BR /&gt;String2='&amp;amp;aaaa*ggggghgg####';&lt;BR /&gt;Output;&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;How to replace special symbols by space</description>
      <pubDate>Tue, 11 Jun 2019 07:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565129#M158610</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2019-06-11T07:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace special symbol by space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565134#M158613</link>
      <description>&lt;P&gt;When you say 'Special Symbols', do you simply mean&amp;nbsp;&lt;SPAN&gt;*,&amp;nbsp;@, &amp;amp;, # or?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 07:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565134#M158613</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-06-11T07:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace special symbol by space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565135#M158614</link>
      <description>If more symbols how can do&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Jun 2019 07:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565135#M158614</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2019-06-11T07:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace special symbol by space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565137#M158615</link>
      <description>&lt;P&gt;One way is to use PRXCHANGE like this. You can add more symbols of you like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have;
String1='aaaaa*bbbb*ddddddd@jjjjjj';
String2='&amp;amp;aaaa*ggggghgg####';
Run;

data want;
 set have;
 String1 = prxchange('s/[*@&amp;amp;#]/ /', -1, String1);
 String2 = prxchange('s/[*@&amp;amp;#]/ /', -1, String2);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Jun 2019 08:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565137#M158615</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-06-11T08:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace special symbol by space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565138#M158616</link>
      <description>&lt;P&gt;Converseley, you can indicate which characters you do not want to be replaced by spaces.&lt;/P&gt;
&lt;P&gt;For instance, the following program wil replace all characters but alphanumerics and '_' with spaces :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 set have;
 String1 = prxchange('s/[^\w]/ /', -1, String1);
 String2 = prxchange('s/[^\w]/ /', -1, String2);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 08:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565138#M158616</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-06-11T08:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace special symbol by space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565141#M158619</link>
      <description>Don't mention symbols in coding&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Jun 2019 08:17:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565141#M158619</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2019-06-11T08:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace special symbol by space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565227#M158670</link>
      <description>&lt;P&gt;You can use the TRANSLATE() function to replace characters.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input string $40. ;
cards;
aaaaa*bbbb*ddddddd@jjjjjj
&amp;amp;aaaa*ggggghgg####
;

data want ;
  set have;
  new_string=translate(string,' ','*&amp;amp;#@');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs             string              new_string

 1     aaaaa*bbbb*ddddddd@jjjjjj    aaaaa bbbb ddddddd jjjjjj
 2     &amp;amp;aaaa*ggggghgg####            aaaa ggggghgg&lt;/PRE&gt;
&lt;P&gt;If you are not sure what to replace perhaps you use the COMPRESS() function to get the list of non-alpha characters in the string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have;
  new_string=translate(string,' ',compress(string,,'ad'));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Jun 2019 13:27:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565227#M158670</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-11T13:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace special symbol by space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565240#M158671</link>
      <description>Sorry already I have done with same code .&lt;BR /&gt;Is there any other way&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Jun 2019 13:43:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565240#M158671</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2019-06-11T13:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace special symbol by space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565291#M158692</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/209685"&gt;@thanikondharish&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Data have;&lt;BR /&gt;String1='aaaaa*bbbb*ddddddd@jjjjjj';&lt;BR /&gt;Output;&lt;BR /&gt;String2='&amp;amp;aaaa*ggggghgg####';&lt;BR /&gt;Output;&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;How to replace special symbols by space&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;SHOW the required output &lt;STRONG&gt;or&lt;/STRONG&gt; explicitly list which characters you consider "special characters". For some purpose I might consider "a" as a "special character". &lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 15:26:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-replace-special-symbol-by-space/m-p/565291#M158692</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-11T15:26:36Z</dc:date>
    </item>
  </channel>
</rss>

