<?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: character functions in SAS Software for Learning Community</title>
    <link>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887706#M1361</link>
    <description>&lt;P&gt;If you like the idea of splitting based on the uppercase letter, you could do it like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data gfg;
length full_name $20 ;
input full_name $;

split=findc(full_name,,'U',2) ; *position of first uppercase letter found, starting search at position 2 of the string ;

first_name = substr(full_name, 1, split-1);
last_name = substr(full_name, split);

datalines;
AlluArjun
PavanKalyan
RangaiahNaidu
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Aug 2023 14:17:20 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2023-08-03T14:17:20Z</dc:date>
    <item>
      <title>character functions</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887694#M1358</link>
      <description>&lt;P&gt;data gfg;&lt;BR /&gt;length full_name $20.;&lt;BR /&gt;input full_name $;&lt;BR /&gt;first_name = substr(full_name, 1, floor(length(full_name)/2));&lt;BR /&gt;last_name = substr(full_name, floor(length(full_name)/2)+1);&lt;BR /&gt;datalines;&lt;BR /&gt;AlluArjun&lt;BR /&gt;PavanKalyan&lt;BR /&gt;RangaiahNaidu&lt;BR /&gt;;&lt;BR /&gt;run; I had tried this code but didn't get my desired output .I want output should be like this&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;first&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;last&lt;BR /&gt;Allu&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Arjun&lt;BR /&gt;Pavan&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Kalyan&lt;BR /&gt;Rangaiah Naidu&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 13:49:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887694#M1358</guid>
      <dc:creator>112211</dc:creator>
      <dc:date>2023-08-03T13:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: character functions</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887697#M1359</link>
      <description>&lt;P&gt;You're splitting the names based on the midpoint of the string.&amp;nbsp; So it results in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;                        first_     last_
Obs      full_name       name      name

 1     AlluArjun        Allu      Arjun
 2     PavanKalyan      Pavan     Kalyan
 3     RangaiahNaidu    Rangai    ahNaidu
&lt;/PRE&gt;
&lt;P&gt;You'll need some other logic for splitting the names.&amp;nbsp; It for the sample you showed, perhaps you could split the string at the location of the second uppercase letter.&amp;nbsp; Would that work for your data?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 13:58:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887697#M1359</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-03T13:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: character functions</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887705#M1360</link>
      <description>no&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Aug 2023 14:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887705#M1360</guid>
      <dc:creator>112211</dc:creator>
      <dc:date>2023-08-03T14:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: character functions</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887706#M1361</link>
      <description>&lt;P&gt;If you like the idea of splitting based on the uppercase letter, you could do it like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data gfg;
length full_name $20 ;
input full_name $;

split=findc(full_name,,'U',2) ; *position of first uppercase letter found, starting search at position 2 of the string ;

first_name = substr(full_name, 1, split-1);
last_name = substr(full_name, split);

datalines;
AlluArjun
PavanKalyan
RangaiahNaidu
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 14:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887706#M1361</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-03T14:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: character functions</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887708#M1362</link>
      <description>&lt;P&gt;If you don't want to split based on upper case letter, what logic can you use to split in the appropriate location?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 14:18:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887708#M1362</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-03T14:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: character functions</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887710#M1363</link>
      <description>&lt;P&gt;Specify a RULE for programming. Examples help but do not define a RULE.&lt;/P&gt;
&lt;P&gt;Programs use rules. I can make your example work but it would not work for any other values than the ones shown because it would work for example values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the "rule" is the "the last name is the second occurrence of a capital letter" then the code means "identify the position of the second capital letter". Which leads to possible use of the ANYUPPER function .&lt;/P&gt;
&lt;PRE&gt;data gfg;
length full_name $20.;
input full_name $;
secondcapital = anyupper(substr(full_name,2))+1;
first= substr(full_name, 1,secondcapital-1);
last= substr(full_name, secondcapital);
datalines;
AlluArjun
PavanKalyan
RangaiahNaidu
;&lt;/PRE&gt;
&lt;P&gt;We search the full name starting at position 2 because the function Anyupper returns the first position of an upper case letter. Then add 1 to get the actual position since the first character was ignored.&lt;/P&gt;
&lt;P&gt;Then use that separate the words.&lt;/P&gt;
&lt;P&gt;Note: if there is no second capital this will throw an error because the position won't be found and you will need to define a different rule for that case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/446448"&gt;@112211&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;data gfg;&lt;BR /&gt;length full_name $20.;&lt;BR /&gt;input full_name $;&lt;BR /&gt;first_name = substr(full_name, 1, floor(length(full_name)/2));&lt;BR /&gt;last_name = substr(full_name, floor(length(full_name)/2)+1);&lt;BR /&gt;datalines;&lt;BR /&gt;AlluArjun&lt;BR /&gt;PavanKalyan&lt;BR /&gt;RangaiahNaidu&lt;BR /&gt;;&lt;BR /&gt;run; I had tried this code but didn't get my desired output .I want output should be like this&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;first&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;last&lt;BR /&gt;Allu&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Arjun&lt;BR /&gt;Pavan&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Kalyan&lt;BR /&gt;Rangaiah Naidu&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 14:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887710#M1363</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-08-03T14:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: character functions</title>
      <link>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887711#M1364</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/446448"&gt;@112211&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;no&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Really , you marked your own answer of NO to a question as an accepted solution. Please describe how that is an actual solution.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 14:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Software-for-Learning/character-functions/m-p/887711#M1364</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-08-03T14:28:44Z</dc:date>
    </item>
  </channel>
</rss>

