<?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: Separate Full Name to FirstName and LastName in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458670#M29538</link>
    <description>&lt;P&gt;While you may have obscure problems with names like Vincent Van Gogh, your basic idea for first and last name are correct.&amp;nbsp; You can check whether there are 3 names, and only assign the middle name if there is one.&amp;nbsp; The DATA step syntax is easy:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if countw(fullname) &amp;gt; 2 then second = scan(fullname, 2, ' ');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SQL syntax is harder, and just a little beyond my SQL knowledge.&amp;nbsp; I believe you would need a CASE statement that checks the results of the COUNTW function, and applies the SCAN function if there are 3 names, but returns a blank if there are fewer than 3 names.&lt;/P&gt;</description>
    <pubDate>Mon, 30 Apr 2018 14:44:10 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-04-30T14:44:10Z</dc:date>
    <item>
      <title>Separate Full Name to FirstName and LastName</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458664#M29536</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;How do I split full name into First Name and Last Name?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;Data:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;Full Name&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;George W. Bush&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;George W Bush&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;George Bush&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;Desired Output:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;FirstName&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LastName&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;George W.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Bush&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;George W&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bush&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;George&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bush&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;(Note: I need the FirstName to include the Middle Initial if it exists.)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;If I use:&lt;BR /&gt;,scan(fullname,1,' ') AS first&lt;BR /&gt;,scan(fullname,2,' ') AS second&lt;BR /&gt;,scan(fullname,-1,' ') AS last&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;I get:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;First&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Second&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Last&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;George&amp;nbsp; &amp;nbsp; &amp;nbsp;W.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Bush&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;George&amp;nbsp; &amp;nbsp; &amp;nbsp;W&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bush&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;George&amp;nbsp; &amp;nbsp; &amp;nbsp;Bush&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Bush&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Helvetica','sans-serif'; color: #333333;"&gt;Thanks so much for your help!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 14:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458664#M29536</guid>
      <dc:creator>jsphnwllms</dc:creator>
      <dc:date>2018-04-30T14:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Separate Full Name to FirstName and LastName</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458669#M29537</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input FullName $30.;
datalines;
George W. Bush
George W Bush
George Bush
;

data want;
set have;
call scan(fullname, -1, position, length);
firstname=substr(fullname,1,position-1);
last=scan(fullname,-1,' ') ;
keep firstname last fullname;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Apr 2018 14:43:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458669#M29537</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-30T14:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: Separate Full Name to FirstName and LastName</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458670#M29538</link>
      <description>&lt;P&gt;While you may have obscure problems with names like Vincent Van Gogh, your basic idea for first and last name are correct.&amp;nbsp; You can check whether there are 3 names, and only assign the middle name if there is one.&amp;nbsp; The DATA step syntax is easy:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if countw(fullname) &amp;gt; 2 then second = scan(fullname, 2, ' ');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SQL syntax is harder, and just a little beyond my SQL knowledge.&amp;nbsp; I believe you would need a CASE statement that checks the results of the COUNTW function, and applies the SCAN function if there are 3 names, but returns a blank if there are fewer than 3 names.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 14:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458670#M29538</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-30T14:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Separate Full Name to FirstName and LastName</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458684#M29541</link>
      <description>&lt;P&gt;Worked perfectly! I greatly appreciate your help!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 15:17:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458684#M29541</guid>
      <dc:creator>jsphnwllms</dc:creator>
      <dc:date>2018-04-30T15:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: Separate Full Name to FirstName and LastName</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458689#M29542</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/168009"&gt;@jsphnwllms&lt;/a&gt;&amp;nbsp;please mark the appropriate solution as correct (not this response). Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 15:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458689#M29542</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-30T15:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Separate Full Name to FirstName and LastName</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458825#M29556</link>
      <description>&lt;P&gt;I used the code below and it worked perfectly!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; want&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
call &lt;SPAN class="token function"&gt;scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;fullname&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;-1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; position&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;length&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
firstname&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;substr&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;fullname&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;position&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
last&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;fullname&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;keep&lt;/SPAN&gt; firstname last fullname&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 20:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458825#M29556</guid>
      <dc:creator>jsphnwllms</dc:creator>
      <dc:date>2018-04-30T20:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Separate Full Name to FirstName and LastName</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458838#M29557</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/168009"&gt;@jsphnwllms&lt;/a&gt;&amp;nbsp; lol Thank you, I hope you learned something from the community while we the community offer the same for all.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tip: Test these solutions intuitively and you will be able to think through how stuff works. All the best!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 20:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458838#M29557</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-04-30T20:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Separate Full Name to FirstName and LastName</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458962#M29565</link>
      <description>&lt;P&gt;I have a follow up question. If the full name has a Jr or III, I need to include Jr and III in the last name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Data:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Full Name&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;George W. Bush&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;George W Bush III&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;George Bush Jr&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Desired Output:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FirstName&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LastName&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;George W.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Bush&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;George W&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bush III&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;George&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Bush Jr&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(Note: I need the FirstName to include the Middle Initial if it exists and the LastName with III or Jr included.)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 13:15:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Separate-Full-Name-to-FirstName-and-LastName/m-p/458962#M29565</guid>
      <dc:creator>jsphnwllms</dc:creator>
      <dc:date>2018-05-01T13:15:49Z</dc:date>
    </item>
  </channel>
</rss>

