<?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: need help to extract middle name from heterogeneous variable with different words coun in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/need-help-to-extract-middle-name-from-heterogeneous-variable/m-p/592022#M169701</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data statisticians;
infile datalines;
input name $30.;
length middle $10;
if countw(name) &amp;gt; 2 then middle = scan(name,2);
datalines;
Ronaldo Al Fisher
H. O. Meir
Lee Sara Kim Ivan
Marco Sina
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 26 Sep 2019 20:51:38 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-09-26T20:51:38Z</dc:date>
    <item>
      <title>need help to extract middle name from heterogeneous variable with different words coun</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-help-to-extract-middle-name-from-heterogeneous-variable/m-p/592016#M169699</link>
      <description>&lt;P&gt;I have the following dataset from which I need help to extract middle name from heterogeneous variable with different words count.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="diff-add"&gt;I&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;saw prior&lt;SPAN&gt;&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/extracting-middle-names-from-a-variable/td-p/287941" target="_self"&gt;link&amp;nbsp;&lt;/A&gt;&lt;/SPAN&gt;but it does not work for me.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="diff-add"&gt;my&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;data has only 1 variable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data statisticians;&lt;BR /&gt;infile datalines ;&lt;BR /&gt;Input name $30. ;&lt;BR /&gt;Datalines;&lt;BR /&gt;Ronaldo Al Fisher&lt;BR /&gt;H. O. Meir&lt;BR /&gt;Lee Sara Kim Ivan&lt;BR /&gt;Marco Sina&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Names with first and last names only should be blank in the new column called middle.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="diff-add"&gt;I&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;tried the following code but it does not work:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data statisticians; &lt;SPAN class="diff-add"&gt;&amp;nbsp;&lt;/SPAN&gt;length middle $10;&lt;SPAN class="diff-add"&gt;&amp;nbsp;&lt;/SPAN&gt;set statisticians;&lt;SPAN class="diff-add"&gt;&amp;nbsp;&lt;/SPAN&gt;if
 count = 2 then middle=.;&lt;SPAN class="diff-add"&gt;&amp;nbsp;&lt;/SPAN&gt;if count = 3 then middle= scan(name,2);   
if count = 4 then middle=scan(name,2); &lt;SPAN class="diff-add"&gt;&amp;nbsp;&lt;/SPAN&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help will be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 20:37:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-help-to-extract-middle-name-from-heterogeneous-variable/m-p/592016#M169699</guid>
      <dc:creator>mrahouma</dc:creator>
      <dc:date>2019-09-26T20:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: need help to extract middle name from heterogeneous variable with different words coun</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-help-to-extract-middle-name-from-heterogeneous-variable/m-p/592022#M169701</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data statisticians;
infile datalines;
input name $30.;
length middle $10;
if countw(name) &amp;gt; 2 then middle = scan(name,2);
datalines;
Ronaldo Al Fisher
H. O. Meir
Lee Sara Kim Ivan
Marco Sina
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Sep 2019 20:51:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-help-to-extract-middle-name-from-heterogeneous-variable/m-p/592022#M169701</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-26T20:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: need help to extract middle name from heterogeneous variable with different words coun</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-help-to-extract-middle-name-from-heterogeneous-variable/m-p/592024#M169702</link>
      <description>&lt;P&gt;I don't think there is a rule to define which string in a four string name is the real middle name.&lt;/P&gt;
&lt;P&gt;If you can suggest such a rule then you can adapt the code you got.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 20:55:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-help-to-extract-middle-name-from-heterogeneous-variable/m-p/592024#M169702</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-09-26T20:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: need help to extract middle name from heterogeneous variable with different words coun</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-help-to-extract-middle-name-from-heterogeneous-variable/m-p/592027#M169703</link>
      <description>Thanks a lot. It works</description>
      <pubDate>Thu, 26 Sep 2019 21:01:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-help-to-extract-middle-name-from-heterogeneous-variable/m-p/592027#M169703</guid>
      <dc:creator>mrahouma</dc:creator>
      <dc:date>2019-09-26T21:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: need help to extract middle name from heterogeneous variable with different words coun</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-help-to-extract-middle-name-from-heterogeneous-variable/m-p/592030#M169704</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/288813"&gt;@mrahouma&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have the following dataset from which I need help to extract middle name from heterogeneous variable with different words count.&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="diff-add"&gt;I&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;saw prior&lt;SPAN&gt;&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/extracting-middle-names-from-a-variable/td-p/287941" target="_self"&gt;link&amp;nbsp;&lt;/A&gt;&lt;/SPAN&gt;but it does not work for me.&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="diff-add"&gt;my&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;data has only 1 variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data statisticians;&lt;BR /&gt;infile datalines ;&lt;BR /&gt;Input name $30. ;&lt;BR /&gt;Datalines;&lt;BR /&gt;Ronaldo Al Fisher&lt;BR /&gt;H. O. Meir&lt;BR /&gt;Lee Sara Kim Ivan&lt;BR /&gt;Marco Sina&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Names with first and last names only should be blank in the new column called middle.&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="diff-add"&gt;I&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;tried the following code but it does not work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;data statisticians; &lt;SPAN class="diff-add"&gt;&amp;nbsp;&lt;/SPAN&gt;length middle $10;&lt;SPAN class="diff-add"&gt;&amp;nbsp;&lt;/SPAN&gt;set statisticians;&lt;SPAN class="diff-add"&gt;&amp;nbsp;&lt;/SPAN&gt;if
 count = 2 then middle=.;&lt;SPAN class="diff-add"&gt;&amp;nbsp;&lt;/SPAN&gt;if count = 3 then middle= scan(name,2);   
if count = 4 then middle=scan(name,2); &lt;SPAN class="diff-add"&gt;&amp;nbsp;&lt;/SPAN&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any help will be greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Are you 100 percent sure that your data does not have an last names that are two or more words such as "Van Dyke" "De La Cruz" without middle names present?&lt;/P&gt;
&lt;P&gt;Or possibly have only a last name (or first)?&lt;/P&gt;
&lt;P&gt;Or have added bits like titles (Dr John Doe, Mrs Jane Roe) or indications like "John Smith II" or "John Smith Junior" or "John Smith the Third"?&lt;/P&gt;
&lt;P&gt;You may want to bring anything with a count &amp;gt; 5 to personal attention.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 21:04:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-help-to-extract-middle-name-from-heterogeneous-variable/m-p/592030#M169704</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-26T21:04:44Z</dc:date>
    </item>
  </channel>
</rss>

