<?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 get middle name from a string? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-middle-name-from-a-string/m-p/692535#M210995</link>
    <description>&lt;PRE&gt;data have;
input a$30. ;
cards;
st john school
st xavier school
st little flower school
;
run;

data want;
 set have;
 want=prxchange('s/^\w+|\w+$//',-1,strip(a));
run;&lt;/PRE&gt;</description>
    <pubDate>Mon, 19 Oct 2020 13:37:24 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2020-10-19T13:37:24Z</dc:date>
    <item>
      <title>How to get middle name from a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-middle-name-from-a-string/m-p/692381#M210919</link>
      <description>&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input a$30.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;st john school&lt;/P&gt;&lt;P&gt;st xavier school&lt;/P&gt;&lt;P&gt;st little flower school&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want&lt;/P&gt;&lt;P&gt;john&lt;/P&gt;&lt;P&gt;xavier&lt;/P&gt;&lt;P&gt;little flower&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can i get code for this?many thanks&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2020 18:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-middle-name-from-a-string/m-p/692381#M210919</guid>
      <dc:creator>shravanisreeyan</dc:creator>
      <dc:date>2020-10-18T18:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get middle name from a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-middle-name-from-a-string/m-p/692391#M210925</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;

input a$30. ;

cards;
st john school
st xavier school
st little flower school
;

run;

data want;
 set have;
 length need $100;
 do _n_=2 to countw(a,' ')-1;
  need=catx(' ',need,scan(a,_n_));
 end;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Oct 2020 19:46:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-middle-name-from-a-string/m-p/692391#M210925</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-10-18T19:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get middle name from a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-middle-name-from-a-string/m-p/692393#M210927</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data have;

input a$30. ;

cards;
st john school
st xavier school
st little flower school
;

run;

data want;
 set have;
 length need $100;
 _n_=anyspace(strip(a));
 need=substr(a,_n_,anyspace(strip(a),-99)-_n_);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Oct 2020 20:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-middle-name-from-a-string/m-p/692393#M210927</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-10-18T20:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get middle name from a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-middle-name-from-a-string/m-p/692394#M210928</link>
      <description>&lt;P&gt;Hello, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/313526"&gt;@shravanisreeyan&lt;/a&gt;, maybe you could please provide more realistic example, so we can solve the real problem?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;What do you want to have as a result if a name does not have a middle name? Does that ever happen in your data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you want as a result if a last name has two "words", such as Stan Van Gundy, in this case Van Gundy is the last name, and no middle name. Does that ever happen in your data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Parsing names can require some pretty complicated rules, if you are working with real world data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 10:25:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-middle-name-from-a-string/m-p/692394#M210928</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-19T10:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get middle name from a string?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-middle-name-from-a-string/m-p/692535#M210995</link>
      <description>&lt;PRE&gt;data have;
input a$30. ;
cards;
st john school
st xavier school
st little flower school
;
run;

data want;
 set have;
 want=prxchange('s/^\w+|\w+$//',-1,strip(a));
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Oct 2020 13:37:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-middle-name-from-a-string/m-p/692535#M210995</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-10-19T13:37:24Z</dc:date>
    </item>
  </channel>
</rss>

