<?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: Variable split in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215713#M39799</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are options in the Input statement using pointer controls &lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/67407/HTML/default/viewer.htm#n0oaql83drile0n141pdacojq97s.htm" title="http://support.sas.com/documentation/cdl/en/lestmtsref/67407/HTML/default/viewer.htm#n0oaql83drile0n141pdacojq97s.htm"&gt;SAS(R) 9.4 Statements: Reference, Third Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;or allow reading space (&amp;amp; : ~) &lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/67407/HTML/default/viewer.htm#n0lrz3gb7m9e4rn137op544ddg0v.htm" title="http://support.sas.com/documentation/cdl/en/lestmtsref/67407/HTML/default/viewer.htm#n0lrz3gb7m9e4rn137op544ddg0v.htm"&gt;SAS(R) 9.4 Statements: Reference, Third Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Using fcmp with own defined formats or the automatic _infile_ variable used with SAS functions&lt;/P&gt;&lt;P&gt;In case the basic string /input functions of SAS are not sufficient you can use &lt;A href="http://www2.sas.com/proceedings/sugi29/265-29.pdf" title="http://www2.sas.com/proceedings/sugi29/265-29.pdf"&gt;http://www2.sas.com/proceedings/sugi29/265-29.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More possibilities to optimize and change as I would like to try.&lt;/P&gt;&lt;P&gt;If you are learning than it is getting aware of those. If you are delivering a project it is applying those with coding at cost/profit working hours. At what one are you in, I was guessing learning.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Apr 2015 14:28:17 GMT</pubDate>
    <dc:creator>jakarman</dc:creator>
    <dc:date>2015-04-03T14:28:17Z</dc:date>
    <item>
      <title>Variable split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215710#M39796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've a data like this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dataset name: name_split&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 187px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl64" height="20" width="187"&gt;Fullname_new&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;LAWRENCE P POWERS, III&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;David R. Fox&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;ROBERT STEVEN SHAPIRO&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;JOHN E KIRK, IV&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="20" style="border-top: none;"&gt;A JOHN KIRK&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want data like this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="290"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="75"&gt;Firstname&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="87"&gt;Secondname&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;Lastname&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;Suffix&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;LAWRENCE&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;P&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;POWERS&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;III&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;David&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;R&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;Fox&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;ROBERT&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;STEVEN&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;SHAPIRO&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;JOHN &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;E&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;KIRK&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;IV&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;"&gt;JOHN &lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;KIRK&lt;/TD&gt;&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried this code,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; new_name;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; name_split;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; first_name=scan(fullname_new,&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: 'Courier New'; font-size: 10pt;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Middle_name=scan(fullname_new,&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: 'Courier New'; font-size: 10pt;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; last_name=scan(fullname_new,&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: 'Courier New'; font-size: 10pt;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; length(Middle_name) gt &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;then&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; last_name=Middle_name;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; last_name=Middle_name &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;then&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Middle_name=&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: 'Courier New'; font-size: 10pt;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; new_name_suff;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; name_split;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; suffix=scan(fullname_new,-&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: 'Courier New'; font-size: 10pt;"&gt;','&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; length(suffix) gt &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;then&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;sort&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;=new_name;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; fullname_new;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;sort&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;=new_name_suff;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; fullname_new;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; name;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;update&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; new_name new_name_suff;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; fullname_new;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; fullname;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; name;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; length(first_name) lt &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;Middle_name=scan(fullname_new,&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: 'Courier New'; font-size: 10pt;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;First_name=scan(fullname_new,&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: 'Courier New'; font-size: 10pt;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;last_name=scan(fullname_new,&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-family: 'Courier New'; font-size: 10pt;"&gt;' '&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;);&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;run; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; fullname1;&lt;/SPAN&gt; &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;update&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; name &lt;SPAN style="font-family: 'Courier New'; font-size: 13.3333330154419px;"&gt;fullname&lt;/SPAN&gt;;&lt;/SPAN&gt; &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: blue; font-family: 'Courier New'; font-size: 10pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt; fullname_new;&lt;/SPAN&gt; &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-size: 10pt;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt; &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Although this code works with the data which I've, I'm worried if either middle name or suffix exceeds (in future data) greater than 2 or 4 characters. There should not be any special characters in derived fields as well.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;I would appreciate for any help you offer me.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 12:23:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215710#M39796</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-04-03T12:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: Variable split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215711#M39797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your question is an unsolvable one.&lt;/P&gt;&lt;P&gt;- How can you know whether it is a secondname or a double word lastname&lt;/P&gt;&lt;P&gt;- think about this one CSV comma separated. Than de decimal parts are comma delimited.&amp;nbsp; What is the meaning of a comma?&lt;/P&gt;&lt;P&gt;Unless you have some additional information you cannot segregate.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 13:49:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215711#M39797</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-04-03T13:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Variable split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215712#M39798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;- How can you know whether it is a secondname or a double word lastname - &lt;EM&gt;letter with more than two characters are treated as last name. &lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;- think about this one CSV comma separated. Than de decimal parts are comma delimited.&amp;nbsp; What is the meaning of a comma? - &lt;EM&gt;commas are from flat file which we need to remove during\after split but before result.&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Unless you have some additional information you cannot segregate. - &lt;EM&gt;any possibilities to optimize my code or generate a new code to produce the result as I mentioned?&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 14:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215712#M39798</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-04-03T14:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Variable split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215713#M39799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are options in the Input statement using pointer controls &lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/67407/HTML/default/viewer.htm#n0oaql83drile0n141pdacojq97s.htm" title="http://support.sas.com/documentation/cdl/en/lestmtsref/67407/HTML/default/viewer.htm#n0oaql83drile0n141pdacojq97s.htm"&gt;SAS(R) 9.4 Statements: Reference, Third Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;or allow reading space (&amp;amp; : ~) &lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/67407/HTML/default/viewer.htm#n0lrz3gb7m9e4rn137op544ddg0v.htm" title="http://support.sas.com/documentation/cdl/en/lestmtsref/67407/HTML/default/viewer.htm#n0lrz3gb7m9e4rn137op544ddg0v.htm"&gt;SAS(R) 9.4 Statements: Reference, Third Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Using fcmp with own defined formats or the automatic _infile_ variable used with SAS functions&lt;/P&gt;&lt;P&gt;In case the basic string /input functions of SAS are not sufficient you can use &lt;A href="http://www2.sas.com/proceedings/sugi29/265-29.pdf" title="http://www2.sas.com/proceedings/sugi29/265-29.pdf"&gt;http://www2.sas.com/proceedings/sugi29/265-29.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More possibilities to optimize and change as I would like to try.&lt;/P&gt;&lt;P&gt;If you are learning than it is getting aware of those. If you are delivering a project it is applying those with coding at cost/profit working hours. At what one are you in, I was guessing learning.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 14:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215713#M39799</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-04-03T14:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Variable split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215714#M39800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;pid=prxparse('/(\w+) (\w+\.?) (\w+)\,?(\D+)/');&lt;/P&gt;&lt;P&gt;input fullname $50.;&lt;/P&gt;&lt;P&gt;if prxmatch('/^\S\b/',fullname)&amp;gt;0 then fullname=prxchange('s/^(\S\b)(\s\w+)(\s.*)/$2 $1$3/',-1,fullname);&lt;/P&gt;&lt;P&gt;if prxmatch(pid,fullname) then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; firstname=prxposn(pid,1,fullname);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; middlename=prxposn(pid,2,fullname);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; lastname=prxposn(pid,3,fullname);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; suffix=prxposn(pid,4,fullname);&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;LAWRENCE P POWERS, III&lt;/P&gt;&lt;P&gt;David R. Fox&lt;/P&gt;&lt;P&gt;ROBERT STEVEN SHAPIRO&lt;/P&gt;&lt;P&gt;JOHN E KIRK, IV&lt;/P&gt;&lt;P&gt;A JOHN KIRK&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 14:34:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215714#M39800</guid>
      <dc:creator>slchen</dc:creator>
      <dc:date>2015-04-03T14:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: Variable split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215715#M39801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fantastic!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May I request you to tell me about \w+ in prxparse and &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;\S\b and &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;/$2 $1$3/&lt;/SPAN&gt; in prxmatch?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 14:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215715#M39801</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-04-03T14:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Variable split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215716#M39802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something else to consider besides last names with spaces are hyphenated names such as Jonh J Cartwright-Pickering.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also assuming 2 characters is a middle name fails with many nationalities.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How many records do you have to process and will the source continue to NOT have moved into 1990's level database structures of having separate fields?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're going to have this going on into the future you really want to bring issues like this to whoever is collecting the data that there may be much more cost and likely errors in trying to post-process names than the cost to collect them in a better format.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 14:57:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215716#M39802</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-04-03T14:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Variable split</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215717#M39803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data have;
input Fullname_new $40.;
cards;
LAWRENCE P POWERS, III
David R. Fox
ROBERT STEVEN SHAPIRO
JOHN E KIRK, IV
A JOHN KIRK
;
run;
data want;
 set have;
 length Firstname&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Secondname&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Lastname&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Suffix temp $ 40;
&amp;nbsp; Firstname=scan(Fullname_new,1,,'ps');
&amp;nbsp; Secondname=scan(Fullname_new,2,,'ps');
&amp;nbsp; Lastname=scan(Fullname_new,3,,'ps');
&amp;nbsp; Suffix=scan(Fullname_new,4,,'ps');
 if length(Firstname)=1 then do;temp=Firstname;Firstname=Secondname;Secondname=temp;end;
 drop temp;
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;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 15:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-split/m-p/215717#M39803</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-04-03T15:07:55Z</dc:date>
    </item>
  </channel>
</rss>

