<?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 extract the Name into Fname and Lname? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113278#M292682</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;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Sharp I got it it was some mistake done by me . be in touch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sarath Sankar V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Jun 2013 13:20:19 GMT</pubDate>
    <dc:creator>SarathSV</dc:creator>
    <dc:date>2013-06-20T13:20:19Z</dc:date>
    <item>
      <title>How to extract the Name into Fname and Lname?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113274#M292678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;?data extract;&lt;/P&gt;&lt;P&gt;length Name $15.;&lt;/P&gt;&lt;P&gt;input Name $ Age;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;TomHanks&amp;nbsp;&amp;nbsp;&amp;nbsp; 39&lt;/P&gt;&lt;P&gt;WillSmith&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 35&lt;/P&gt;&lt;P&gt;ChristopherLee 38&lt;/P&gt;&lt;P&gt;RusselCrow&amp;nbsp; 39&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;how I could extract the Name variable into Fname and Lname&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like&lt;/P&gt;&lt;P&gt;Fname&amp;nbsp;&amp;nbsp; Lname&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Age&lt;/P&gt;&lt;P&gt;Tom&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hanks&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 39 &lt;/P&gt;&lt;P&gt;Wll&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Smith&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 35&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2013 11:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113274#M292678</guid>
      <dc:creator>SarathSV</dc:creator>
      <dc:date>2013-06-20T11:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the Name into Fname and Lname?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113275#M292679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data extract;
length Name $15.;
input Name $ Age;
cards;
TomHanks&amp;nbsp;&amp;nbsp;&amp;nbsp; 39
WillSmith&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 35
ChristopherLee 38
RusselCrow&amp;nbsp; 39
;
data FirstLastNames;
length first last $ 16;
re = prxparse('/([A-Z][a-z]+)([A-Z][a-z]+)/o');
set extract;
if prxmatch(re, name) then
do;
last = prxposn(re, 1, name);
first = prxposn(re, 2, name);
end;
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;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2013 11:48:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113275#M292679</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-06-20T11:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the Name into Fname and Lname?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113276#M292680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am getting the result but in the output variable 'last' is only displaying&amp;nbsp; variable&amp;nbsp; 'first' is not displaying.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sarath sankar V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2013 12:33:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113276#M292680</guid>
      <dc:creator>SarathSV</dc:creator>
      <dc:date>2013-06-20T12:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the Name into Fname and Lname?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113277#M292681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why? I have no such problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jiveImage" src="https://communities.sas.com/legacyfs/online/3730_pastedImage_0.png" style="width: 746px; height: 105px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2013 13:11:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113277#M292681</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-06-20T13:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the Name into Fname and Lname?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113278#M292682</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;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Sharp I got it it was some mistake done by me . be in touch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sarath Sankar V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2013 13:20:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113278#M292682</guid>
      <dc:creator>SarathSV</dc:creator>
      <dc:date>2013-06-20T13:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the Name into Fname and Lname?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113279#M292683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or just using Prxchange:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data extract;&lt;/P&gt;&lt;P&gt;length Name $15.;&lt;/P&gt;&lt;P&gt;input Name $ Age;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;TomHanks 39&lt;/P&gt;&lt;P&gt;WillSmith 35&lt;/P&gt;&lt;P&gt;ChristopherLee 38&lt;/P&gt;&lt;P&gt;RusselCrow 39&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set extract;&lt;/P&gt;&lt;P&gt;&amp;nbsp; fname=prxchange('s/([A-Z][a-z]+)([A-Z][a-z]+)/$1/o',-1, name);&lt;/P&gt;&lt;P&gt;&amp;nbsp; lname=prxchange('s/([A-Z][a-z]+)([A-Z][a-z]+)/$2/o',-1, name);&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or for a none PRX approach,&lt;/P&gt;&lt;P&gt;data want_noprx;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set extract;&lt;/P&gt;&lt;P&gt;&amp;nbsp; lp=anyupper(substr(name,2));&lt;/P&gt;&lt;P&gt;&amp;nbsp; fname=substr(name,1,lp);&lt;/P&gt;&lt;P&gt;&amp;nbsp; lname=substr(name,lp+1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2013 15:49:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-the-Name-into-Fname-and-Lname/m-p/113279#M292683</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-06-20T15:49:06Z</dc:date>
    </item>
  </channel>
</rss>

