<?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 remove Trailing Letters in Names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253241#M309787</link>
    <description>&lt;P&gt;Well, if we're going to expand the list of possibilities let's make sure we cover them all.&amp;nbsp; I assume you want John, P. Richard to become John, Richard.&amp;nbsp; But what should each of these become?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;John, R.&lt;/P&gt;
&lt;P&gt;John, R.C.&lt;/P&gt;
&lt;P&gt;John, R. C.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can think of any more possibilities, this would be the time to mention them.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Feb 2016 18:27:33 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-02-29T18:27:33Z</dc:date>
    <item>
      <title>How to remove Trailing Letters in Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253220#M309784</link>
      <description>&lt;P&gt;Hi I want to clean up my data which contains full name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) John, Smith&lt;/P&gt;
&lt;P&gt;2) Kevin, Space R.&lt;/P&gt;
&lt;P&gt;3) John, Doe R.C.&lt;/P&gt;
&lt;P&gt;4) Kevin, Space Joseph&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically i want 2,3, and 4 to look like 1 and get rid of trailling&amp;nbsp;letter or name (i.e. R., R.C., Joseph).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 16:52:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253220#M309784</guid>
      <dc:creator>ysk</dc:creator>
      <dc:date>2016-02-29T16:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove Trailing Letters in Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253226#M309785</link>
      <description>&lt;P&gt;Here's a statement that should do the trick:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;new_name = catx(', ', scan(name, 1, ', '), scan(name, 2, ', '));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notice that you can still run into trouble with two-word names before the comma.&amp;nbsp; A mildly more complex approach could handle that.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 17:17:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253226#M309785</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-02-29T17:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove Trailing Letters in Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253235#M309786</link>
      <description>Hi Astounding, thank you for your reply.&lt;BR /&gt;&lt;BR /&gt;How about instances where names are like this.&lt;BR /&gt;&lt;BR /&gt;1) John, P. Richard&lt;BR /&gt;&lt;BR /&gt;how can i clean this up to align with the first example?&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 29 Feb 2016 18:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253235#M309786</guid>
      <dc:creator>ysk</dc:creator>
      <dc:date>2016-02-29T18:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove Trailing Letters in Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253241#M309787</link>
      <description>&lt;P&gt;Well, if we're going to expand the list of possibilities let's make sure we cover them all.&amp;nbsp; I assume you want John, P. Richard to become John, Richard.&amp;nbsp; But what should each of these become?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;John, R.&lt;/P&gt;
&lt;P&gt;John, R.C.&lt;/P&gt;
&lt;P&gt;John, R. C.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can think of any more possibilities, this would be the time to mention them.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 18:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253241#M309787</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-02-29T18:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove Trailing Letters in Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253244#M309788</link>
      <description>Here are different variations (format) of names in the dataset&lt;BR /&gt;&lt;BR /&gt;1. John,Doe    -&amp;gt; John,Doe&lt;BR /&gt;2. John,Doe D. -&amp;gt; John,Doe&lt;BR /&gt;2. John,D. Doe  -&amp;gt; John,Doe&lt;BR /&gt;3. John,Doe-Johnson -&amp;gt; John, Doe-Johnson&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 29 Feb 2016 18:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253244#M309788</guid>
      <dc:creator>ysk</dc:creator>
      <dc:date>2016-02-29T18:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove Trailing Letters in Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253250#M309789</link>
      <description>&lt;P&gt;OK, here's one way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;new_name = scan(name, 1, ',');&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;part2 = scan(name, 2, ',');&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;if part2 &amp;gt; ' ' then do;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; new_name = trim(new_name) || ',';&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; do i=1 to countw(part2, ' ');&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; next_piece = scan(part2, i, ' ');&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if index(next_piece, '.') = 0 then new_name = trim(new_name) || ' ' || next_piece;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;I'm not expecting any problems with it, but this is untested code so let me know if you have any difficulties with it.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Feb 2016 19:00:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253250#M309789</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-02-29T19:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove Trailing Letters in Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253326#M309790</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input name $40.;
cards;
John, Smith
Kevin, Space R.
John, Doe R.C.
Kevin, Space Joseph
John,Doe 
John,Doe D.
John,D. Doe 
John,Doe-Johnson 
;
run;
data want;
 set have;
 temp=prxchange('s/[a-z]\./ /i',-1,name);
 new_name=catx(',',scan(temp,1,', '),scan(temp,2,', '));
 drop temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Mar 2016 01:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-Trailing-Letters-in-Names/m-p/253326#M309790</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-01T01:44:25Z</dc:date>
    </item>
  </channel>
</rss>

