<?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: Creating Last First Mi from a single variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Last-First-Mi-from-a-single-variable/m-p/204085#M50868</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Beware of two word last names such as Le Blank, Van Dorp and such.&lt;/P&gt;&lt;P&gt;You might want to run a word count to see if you have more than 3 words in the field to bring possible problems to your attention.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Jun 2015 20:58:13 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-06-11T20:58:13Z</dc:date>
    <item>
      <title>Creating Last First Mi from a single variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Last-First-Mi-from-a-single-variable/m-p/204081#M50864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The data I have (in one field):&lt;/P&gt;&lt;P&gt;Name&amp;nbsp; &lt;/P&gt;&lt;P&gt;Doe,&amp;nbsp; John&amp;nbsp; M.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data I want (in 3 fields):&lt;/P&gt;&lt;P&gt;Last&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; First&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mi&lt;/P&gt;&lt;P&gt;Doe&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; John&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 19:53:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Last-First-Mi-from-a-single-variable/m-p/204081#M50864</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2015-06-11T19:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Last First Mi from a single variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Last-First-Mi-from-a-single-variable/m-p/204082#M50865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very simplistic but works if there are no composed names, prefixes, more than one initial, etc...:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; name='Doe, John M';&lt;/P&gt;&lt;P&gt;&amp;nbsp; last=scan(name,1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; first=scan(name,2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; Mi=scan(name,3);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;CTorres&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 20:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Last-First-Mi-from-a-single-variable/m-p/204082#M50865</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2015-06-11T20:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Last First Mi from a single variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Last-First-Mi-from-a-single-variable/m-p/204083#M50866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Simplistic works for me!&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 20:04:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Last-First-Mi-from-a-single-variable/m-p/204083#M50866</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2015-06-11T20:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Last First Mi from a single variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Last-First-Mi-from-a-single-variable/m-p/204084#M50867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure how dynamic you need the code to be, whether your Name field is consistent or not with the length of the Middle Initial and whether there are more than two names for the first name, but this code will help with your example you gave.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input name $25.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;Doe, John M.&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;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;format Last First $15. FirstMi $20. Mi $1;&lt;/P&gt;&lt;P&gt;Last=scan(Name,1,",");&lt;/P&gt;&lt;P&gt;FirstMi=scan(Name,2,",");&lt;/P&gt;&lt;P&gt;First=strip(scan(FirstMi,1," "));&lt;/P&gt;&lt;P&gt;Mi=compress(scan(FirstMi,2," "),".");&lt;/P&gt;&lt;P&gt;drop FirstMi;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 20:04:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Last-First-Mi-from-a-single-variable/m-p/204084#M50867</guid>
      <dc:creator>dcruik</dc:creator>
      <dc:date>2015-06-11T20:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Last First Mi from a single variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-Last-First-Mi-from-a-single-variable/m-p/204085#M50868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Beware of two word last names such as Le Blank, Van Dorp and such.&lt;/P&gt;&lt;P&gt;You might want to run a word count to see if you have more than 3 words in the field to bring possible problems to your attention.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 20:58:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-Last-First-Mi-from-a-single-variable/m-p/204085#M50868</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-06-11T20:58:13Z</dc:date>
    </item>
  </channel>
</rss>

