<?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: Split the string into two parts. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133097#M27084</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is actually why I did my code the way I did Karl. If the name has more than one uppercase, the first two sections will be put into the first name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MaryAnne&amp;nbsp; Smith.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However if you have sir names like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EgglyMcBagelface&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then _null_'s code would give the correct Eggly McBagelface. So theoritically you have to be cautious using either approach, or change your code quite a bit to look out for 3 capital letters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_null_, for the record, you sir are a wizard.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 May 2013 16:32:13 GMT</pubDate>
    <dc:creator>Anotherdream</dc:creator>
    <dc:date>2013-05-09T16:32:13Z</dc:date>
    <item>
      <title>Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133091#M27078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I my dataset i have a column called "Name" which contain First name and last name of the person. Unfortunately there is no delimiter between first name and last name.So i want to add a space between First name and last name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only Clue i have to identify the firstname and last name is ,Both names should start with Capital letter and rest of them&amp;nbsp; all is small letters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SanjeevKumar&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;YaswanthJuluri.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In above names First name is Sanjeev,Yaswanth and Last name is Kuridi and Juluri.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you people understand my requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&amp;amp;Regards.&lt;/P&gt;&lt;P&gt;Sanjeev.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2013 15:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133091#M27078</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-05-09T15:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133092#M27079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data answer;&lt;/P&gt;&lt;P&gt;set yourdataset;&lt;/P&gt;&lt;P&gt;Firstname=substr(name,1,anyupper(name,-(length(name)+10))-1);&lt;/P&gt;&lt;P&gt;lastname=substr(name,anyupper(name,-(length(name)+10)),length(name)+5);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There ya go&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The any upper function, with a negative second value &amp;gt; the total length of string searches from right to left. So it searches for the first Upper string from the right side of the string. Therefore the first name is simply Substr(1- VAR-1)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2013 15:17:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133092#M27079</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2013-05-09T15:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133093#M27080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A __default_attr="810872" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code working perfectly.Thanks lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But looking bit complex.&lt;/P&gt;&lt;P&gt;Just now i tried in another way,&lt;/P&gt;&lt;P&gt;Here we go.....:-)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data Name1;&lt;/P&gt;&lt;P&gt;set mydataset;&lt;/P&gt;&lt;P&gt;Firstname=substr(name,1,notlower(substr(name,2)));&lt;/P&gt;&lt;P&gt;Lastname=substr(name,length(firstname)+1);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Sanjeev.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2013 15:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133093#M27080</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-05-09T15:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133094#M27081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lets see if any one provides more simpler then above...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2013 15:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133094#M27081</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-05-09T15:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133095#M27082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That seems overly complicated.&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;_null_&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; name &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$40.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; p = anyupper(name,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;2&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; First = substrn(name,&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,p-&lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; Last = substrn(name,p);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;put&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;_all_&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;cards&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffc0;"&gt;SanjeevKumar&lt;BR /&gt;YaswanthJuluri&lt;BR /&gt;Juluri&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;;;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2013 15:32:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133095#M27082</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-05-09T15:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133096#M27083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not to be a buzzkill, but in the U.S., we have names like MaryAnneSmith or CecildeMille, where you might need to do a little exception processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pardon my OCD &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Karl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2013 16:21:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133096#M27083</guid>
      <dc:creator>KarlK</dc:creator>
      <dc:date>2013-05-09T16:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133097#M27084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is actually why I did my code the way I did Karl. If the name has more than one uppercase, the first two sections will be put into the first name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MaryAnne&amp;nbsp; Smith.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However if you have sir names like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EgglyMcBagelface&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then _null_'s code would give the correct Eggly McBagelface. So theoritically you have to be cautious using either approach, or change your code quite a bit to look out for 3 capital letters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_null_, for the record, you sir are a wizard.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brandon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2013 16:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133097#M27084</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2013-05-09T16:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133098#M27085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Basically if these are indeed proper names then just aint' no good way to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I was a wizard I'd clone myself and go fishing.&amp;nbsp; I do know my functions, some of them anyway.:smileylaugh:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 May 2013 16:40:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133098#M27085</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-05-09T16:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133099#M27086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PRX is more powerful .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input name $40.;&lt;/P&gt;&lt;P&gt;length first middle last $ 40;&lt;/P&gt;&lt;P&gt;re = prxparse('/([A-Z][a-z]*)([A-Z][a-z]*)?([A-Z][a-z]*)?/o');&lt;/P&gt;&lt;P&gt;if prxmatch(re, name) then&lt;/P&gt;&lt;P&gt;do;&lt;/P&gt;&lt;P&gt;first = prxposn(re, 1, name);&lt;/P&gt;&lt;P&gt;middle = prxposn(re, 2, name);&lt;/P&gt;&lt;P&gt;last = prxposn(re, 3, name);&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; put _all_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; cards4;&lt;/P&gt;&lt;P&gt;SanjeevKumar&lt;/P&gt;&lt;P&gt;YaswanthJuluri&lt;/P&gt;&lt;P&gt;Juluri&lt;/P&gt;&lt;P&gt;MaryAnneSmith&lt;/P&gt;&lt;P&gt;CecildeMille&lt;/P&gt;&lt;P&gt;;;;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&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;&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 May 2013 13:14:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133099#M27086</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-05-10T13:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133100#M27087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Liked, PRX is indeed powerful. However, in term of some special cases mentioned above: MaryAnneSmith, where "MaryAnne" is first name in one piece; while in the case of EgglyMcDonald,&amp;nbsp; "McDonald" is the last name. That is just how people spell those names in Western culture. So if they are important to OP, then you may have to come up with a dictionary table to handle that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 May 2013 14:56:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133100#M27087</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-05-10T14:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133101#M27088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this poor equine is totally deceased by now, and there's no way my meager skills would argue with _null_ or Ksharp. I only jumped into the fray because, as we all know, people's names are tricky, and I wanted to encourage the OP to check the results of whatever solution he selected for exceptions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just as a postscript: OK, I cheated on Cecil B. DeMille by purposely messing with the orthography (deMille vs. DeMille). Nevertheless, I think the great Cecil B. would take issue with &lt;STRONG&gt;all&lt;/STRONG&gt; the proffered solutions, as they all give his first name as "Cecilde". &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 May 2013 15:50:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133101#M27088</guid>
      <dc:creator>KarlK</dc:creator>
      <dc:date>2013-05-10T15:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133102#M27089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For this situation, I took HaiKuo's advice , make a dictionay table to maintain it.&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>Sat, 11 May 2013 02:39:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133102#M27089</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-05-11T02:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Split the string into two parts.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133103#M27090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your valuable suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Sanjeev.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 10:38:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-the-string-into-two-parts/m-p/133103#M27090</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-05-24T10:38:38Z</dc:date>
    </item>
  </channel>
</rss>

