<?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 all punctuation characters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/remove-all-punctuation-characters/m-p/541621#M149565</link>
    <description>&lt;P&gt;For your consideration:&lt;/P&gt;
&lt;PRE&gt;data example;
   x="ABC!@#$%^&amp;amp;*()_+=-,./?&amp;gt;&amp;lt;;:[]{}\|DEF`";
   y=compress(x,,'P');
run;&lt;/PRE&gt;
&lt;P&gt;I didn't go through any additional steps to add the double quote character to X but you get the general idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Mar 2019 21:34:03 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-03-08T21:34:03Z</dc:date>
    <item>
      <title>remove all punctuation characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-all-punctuation-characters/m-p/541538#M149530</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can I remove all punctuation characters (except '&amp;amp;')?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I using the following codes&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data a;
  infile datalines dlm=',' truncover;
informat HRM_L2_Step6 $1000. ;
input HRM_L2_Step6 ;
datalines;
!OBAC
1...
1... IPR 
1.CALL RESEA-RCH &amp;amp; DESIGN 
100% RECYCLED PANEL COMPAMY 
20/20 SPEECH 
24/7 TECHNOLOGIES 
2S-SOFISTIK/EJ/TED SISTEMS 
3 S'S 
3-D COMPOSITES
3-D COMPOSITS 
3COM CORPORATION (COMPUTERS COMMUNICATION COMPATIBILITY CORPORATION) 
3M COMPANY (MINNESOTA MINING AND MANUFACTURING COMPANY)
3M INNOVATIVE PROPERTIES COMPANY (MINNESOTA MINING AND MANUFACTURING INNOVATIVE PROPERTIES COMPANY)
3RD ANGLE (U.K.)
3RD ANGLE (U.K.) LTD., HIGHLEY
3RD ANGLE (U.K.) LTD., HIGHLEY, SHROPSHIRE
&amp;gt;&amp;gt;PYROTEX
@ROAD
;
run;

Data b;
Set a;
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"'",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,";",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"^",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"&amp;lt;",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,".",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"`",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"_",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"&amp;gt;",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"''", "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"!",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"+",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"?",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"(",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"£",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"{",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"\",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,")",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"$",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"}",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"|",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,",",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"%",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"[",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"¶",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"-",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"*",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"]",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"/",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"@",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,":",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"~",  "");
HRM_L2_Step6=tranwrd(HRM_L2_Step6,"#",  "");
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;however, for example, for '&lt;CODE class=" language-sas"&gt;!OBAC', I get ' OBAC' rather than 'OBAC'.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;How can I get 'OBAC'?&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;could you please give me some suggestions about this? thanks in advance.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 19:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-all-punctuation-characters/m-p/541538#M149530</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-08T19:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: remove all punctuation characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-all-punctuation-characters/m-p/541545#M149533</link>
      <description>&lt;P&gt;In general, you should be looking at COMPRESS (which removes characters), rather than TRANWRD (which translates them into something else).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For most of your request, you can fit it into a single statement.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HRM_L2_Step6 = compress(HRM_L2_Step6, ";'&amp;lt;.+?/()" );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you look at the COMPRESS documentation, you may also notice that a third parameter lets you use particular letters to abbreviate a request that applies to groups of characters.&amp;nbsp; You may find an abbreviation within that third parameter that handles most of the characters you are interested in removing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0fcshr0ir3h73n1b845c4aq58hz.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0fcshr0ir3h73n1b845c4aq58hz.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 19:26:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-all-punctuation-characters/m-p/541545#M149533</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-08T19:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: remove all punctuation characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-all-punctuation-characters/m-p/541621#M149565</link>
      <description>&lt;P&gt;For your consideration:&lt;/P&gt;
&lt;PRE&gt;data example;
   x="ABC!@#$%^&amp;amp;*()_+=-,./?&amp;gt;&amp;lt;;:[]{}\|DEF`";
   y=compress(x,,'P');
run;&lt;/PRE&gt;
&lt;P&gt;I didn't go through any additional steps to add the double quote character to X but you get the general idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 21:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-all-punctuation-characters/m-p/541621#M149565</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-08T21:34:03Z</dc:date>
    </item>
  </channel>
</rss>

