<?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: Replacing Multiple words in a field using TRANWRD in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189377#M14515</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hope this answers you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;data have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;input id o_name $27.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;datalines;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;1&amp;nbsp; Jose L Smith JR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;2 Angel P Jones SR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;3 Susan DECD White III Trust&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;4 Henry West IV&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;5 John Adams&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;6 Jose DECD Hernandez&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;data want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;length n_name $27;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;array k[5] $4 _temporary_ ('JR', 'SR', 'III', 'IV', 'DECD');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp; n_name = o_name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp; do i = 1 to dim(k);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; word = k&lt;I&gt;;&lt;/I&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n_name = tranwrd(n_name, compress(word), '');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp; n_name = compbl(n_name);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp; output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;keep n_name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Oct 2014 16:41:02 GMT</pubDate>
    <dc:creator>KachiM</dc:creator>
    <dc:date>2014-10-17T16:41:02Z</dc:date>
    <item>
      <title>Replacing Multiple words in a field using TRANWRD</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189375#M14513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have a variable for names and some of those names have some keywords I would like to take out.&amp;nbsp; I was trying using TRANWRD and it works, but I have to do so many TRANWRDS statements to eliminate all the possible keywords I have in my list.&amp;nbsp;&amp;nbsp; I was trying to do a loop, but I am having problems.&amp;nbsp; Can anyone help?&lt;/P&gt;&lt;P&gt;Example Data:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#000000&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" style="border: 1px solid #000000; width: 264px; height: 174px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="padding: 2px; text-align: center; color: #ffffff; font-family: arial,helvetica,sans-serif; background-color: #6690bc;"&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="padding: 2px; text-align: center; color: #ffffff; font-family: arial,helvetica,sans-serif; background-color: #6690bc;"&gt;&lt;STRONG&gt;ORIGINAL_NAME&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: left; color: #000000; background-color: transparent;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: left; color: #000000; background-color: transparent;"&gt;Jose L Smith JR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: left; color: #000000; background-color: transparent;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: left; color: #000000; background-color: transparent;"&gt;Angel P Jones SR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: left; color: #000000; background-color: transparent;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: left; color: #000000; background-color: transparent;"&gt;Susan DECD White III Trust&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: left; color: #000000; background-color: transparent;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: left; color: #000000; background-color: transparent;"&gt;Henry West IV&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: left; color: #000000; background-color: transparent;"&gt;5&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: left; color: #000000; background-color: transparent;"&gt;John Adams&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px; text-align: left; color: #000000; background-color: transparent;"&gt;6&lt;/TD&gt;&lt;TD style="padding: 2px; text-align: left; color: #000000; background-color: transparent;"&gt;Jose DECD Hernandez&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Words I want to eliminate: 'JR', 'SR', 'III', 'IV', 'DECD'.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This is the last code I tried:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DATA WORK.NEWTABLE (KEEP=ID ORIGINAL_NAME NEW_NAME);&lt;/P&gt;&lt;P&gt;SET LIBRARY.NAMES_ID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NEW_NAME=ORIGINAL_NAME;&lt;/P&gt;&lt;P&gt;ARRAY KEYWORDS{*} $ _TEMPORARY_ ('JR', 'SR', 'III', 'IV', 'DECD');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO i=1 TO 5;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NEW_NAME{i+1}=TRANWRD(NEW_NAME{ i }, KEYWORDS{ i }, '');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Desired Results&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="174" style="border: 1px solid rgb(0, 0, 0); width: 435px; height: 172px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;ORIGINAL_NAME&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;NEW_NAME&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Jose L Smith JR&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Jose L Smitn&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Angel P Jones SR&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Angel P Jones&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Susan DECD White III Trust&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Susan White Trust&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Henry West IV&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Henry West&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;John Adams&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;John Adams&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Jose DECD Hernandez&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Jose Hernandez&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 14:57:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189375#M14513</guid>
      <dc:creator>ismahero2</dc:creator>
      <dc:date>2014-10-17T14:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Multiple words in a field using TRANWRD</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189376#M14514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'll bet that you had an array reference error.&lt;/P&gt;&lt;P&gt;New_name is not an array so&lt;/P&gt;&lt;P&gt;NEW_NAME=TRANWRD(NEW_NAME, KEYWORDS{ i }, '');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;would take 5 passes through the step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might want to use&lt;/P&gt;&lt;P&gt;Do I = 1 to dim(Keywords); If you have to add another item, such as 'II', to your list you don't have to change the 5 to 6.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 15:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189376#M14514</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-17T15:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Multiple words in a field using TRANWRD</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189377#M14515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hope this answers you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;data have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;input id o_name $27.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;datalines;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;1&amp;nbsp; Jose L Smith JR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;2 Angel P Jones SR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;3 Susan DECD White III Trust&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;4 Henry West IV&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;5 John Adams&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;6 Jose DECD Hernandez&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;data want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;length n_name $27;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;array k[5] $4 _temporary_ ('JR', 'SR', 'III', 'IV', 'DECD');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp; n_name = o_name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp; do i = 1 to dim(k);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; word = k&lt;I&gt;;&lt;/I&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n_name = tranwrd(n_name, compress(word), '');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp; n_name = compbl(n_name);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;&amp;nbsp;&amp;nbsp; output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;keep n_name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #99ccff;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 16:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189377#M14515</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2014-10-17T16:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Multiple words in a field using TRANWRD</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189378#M14516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't have to make an array since you can just specify the list in the DO loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp; n_name = o_name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; word $&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;27&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; word=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'JR'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'SR'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'III'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'IV'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'DECD'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n_name = tranwrd(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;||n_name, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;||strip(word)||&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp; n_name = compbl(n_name);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;drop&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; word ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 19:12:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189378#M14516</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-10-17T19:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Multiple words in a field using TRANWRD</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189379#M14517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You just want to get rid of them all ? That is it ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
input id o_name $27.;
datalines;
1&amp;nbsp; Jose L Smith JR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
2 Angel P Jones SR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
3 Susan DECD White III Trust
4 Henry West IV&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
5 John Adams&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
6 Jose DECD Hernandez
;
run;
data want;
 set have;
 new_name=prxchange('s/\s+(JR|SR|III|IV|DECD)\s+/ /o',-1,o_name);
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Oct 2014 13:54:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189379#M14517</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-10-18T13:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Multiple words in a field using TRANWRD</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189380#M14518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would use '\b' instead of '\s' so the unwanted words can also be at the beginning or the very end of a string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;new_name=prxchange('s/&lt;STRONG&gt;\b&lt;/STRONG&gt;(JR|SR|III|IV|DECD)&lt;STRONG&gt;\b&lt;/STRONG&gt;/ /o',-1,o_name)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Oct 2014 23:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189380#M14518</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-10-18T23:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing Multiple words in a field using TRANWRD</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189381#M14519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. You are right. I overlook it&amp;nbsp; .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Oct 2014 10:31:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Replacing-Multiple-words-in-a-field-using-TRANWRD/m-p/189381#M14519</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-10-19T10:31:42Z</dc:date>
    </item>
  </channel>
</rss>

