<?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_names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/split-names/m-p/978603#M378644</link>
    <description>&lt;P&gt;Just use some other tool to find the location of the second uppercase letter.&lt;/P&gt;
&lt;P&gt;Such as the VERIFY() function.&lt;/P&gt;
&lt;P&gt;NOTE: remember to include the period in the format specification, or else your input statement will just read the single byte from column 25.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data split_names;
  input name $25.;
datalines;
JohnDoe
SrinivasPavan
KishoreKumar
ChandrasekaRao
Ghandi
;

data want;
  set split_names;
  loc = verify(substr(name,2),'abcdefghijklmnopqrstuvwzy');
  if loc then last=substr(name,loc+1);
  first=substr(name,1,length(name)-lengthn(last));
run;

proc print;
 var name loc first last;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt; Obs    name              loc    first          last

  1     JohnDoe             4    John           Doe
  2     SrinivasPavan       8    Srinivas       Pavan
  3     KishoreKumar        7    Kishore        Kumar
  4     ChandrasekaRao     11    Chandraseka    Rao
  5     Ghandi              6    Ghandi
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Nov 2025 12:46:56 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2025-11-10T12:46:56Z</dc:date>
    <item>
      <title>split_names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-names/m-p/978602#M378643</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data split_names;
input name $25;
datalines;
JohnDoe
SrinivasPavan
KishoreKumar
ChandrasekaRao
;
run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;fHi Experts,&lt;/P&gt;
&lt;P&gt;In the above code i want split names every second capital letter&amp;nbsp; without regex solution please&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;output&lt;BR /&gt;________&lt;BR /&gt;&lt;BR /&gt;John&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Doe&lt;BR /&gt;Srinivas&amp;nbsp;Pavan&lt;BR /&gt;Kishore&amp;nbsp;Kumar&lt;BR /&gt;Chandrasekar&amp;nbsp;Rao&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 12:12:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-names/m-p/978602#M378643</guid>
      <dc:creator>pavank</dc:creator>
      <dc:date>2025-11-10T12:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: split_names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-names/m-p/978603#M378644</link>
      <description>&lt;P&gt;Just use some other tool to find the location of the second uppercase letter.&lt;/P&gt;
&lt;P&gt;Such as the VERIFY() function.&lt;/P&gt;
&lt;P&gt;NOTE: remember to include the period in the format specification, or else your input statement will just read the single byte from column 25.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data split_names;
  input name $25.;
datalines;
JohnDoe
SrinivasPavan
KishoreKumar
ChandrasekaRao
Ghandi
;

data want;
  set split_names;
  loc = verify(substr(name,2),'abcdefghijklmnopqrstuvwzy');
  if loc then last=substr(name,loc+1);
  first=substr(name,1,length(name)-lengthn(last));
run;

proc print;
 var name loc first last;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt; Obs    name              loc    first          last

  1     JohnDoe             4    John           Doe
  2     SrinivasPavan       8    Srinivas       Pavan
  3     KishoreKumar        7    Kishore        Kumar
  4     ChandrasekaRao     11    Chandraseka    Rao
  5     Ghandi              6    Ghandi
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2025 12:46:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-names/m-p/978603#M378644</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-11-10T12:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: split_names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/split-names/m-p/978615#M378647</link>
      <description>&lt;P&gt;Here is an example that adds another case with a middle name.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data split_names;
  input name $25.;
datalines;
JohnDoe
SrinivasPavan
KishoreKumar
ChandrasekaRao
Ghandi
MaryJoeSmith
;
run;

data new;
set split_names;
len=length(name);
ucount = countc(name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'U'); /* count the number of uppercase letters */
next=anyupper(substr(name,2));
upper=anyupper(name,-len); /* position of last uppercase letter */
if next=0 then first=name;
else first=substr(name,1,next);
if ucount=2 then last=substr(name,next+1);
else if ucount=3 then do;
 middle=substr(name,next+1,len-upper-1);
 last=substr(name,upper);
end;
run;

proc print data=new;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Nov 2025 19:13:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/split-names/m-p/978615#M378647</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2025-11-10T19:13:28Z</dc:date>
    </item>
  </channel>
</rss>

