<?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 can I resolve name values and re-assign to the correct fields? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372784#M89173</link>
    <description>&lt;P&gt;I solved the problem with the following code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data clean_fn;
set testing2b;
last_name = scan(FN,-1,' '); 
mi_name = scan(FN,-2,' ');
first_name = scan(FN,-3,' ');
keep FN LN last_name first_name mi_name;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In this dataset, the FN variable contained first, middle and last name as a value. This worked out very well considering the size of the dataset.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jul 2017 16:11:48 GMT</pubDate>
    <dc:creator>colabear</dc:creator>
    <dc:date>2017-07-03T16:11:48Z</dc:date>
    <item>
      <title>How can I resolve name values and re-assign to the correct fields?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372303#M88999</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set containing FIRST NAME and LAST NAME variables. In order to execute my program correctly, I need a clean dataset. But, the one I'm working with has enough issues to keep me busy for days. What I need for the program to work is to have only FN and LN without any special characters or spaces or suffixes. The table below shows what kinds of issues I am encountering. The asterisk indicates missing value. I would like to move probable names to the correct fields.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;FirstName&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;LastName&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;George&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Washington Carver&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;George Washington&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Carver&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;*&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;George W Carver&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;*&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;George W&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;George&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Washington-Carver&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;George&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;WashingtonCarver&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;George&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Carver, III&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data testing1b;
set testing1a;
if ANYPUNCT (clientFirstName)=1 then do
	Fname1=scan (clientFirstName,1,", ");
	Fname2=scan (clientFirstName,2,", ");
	Fname3=scan (clientFirstName,3,", ");
	Fname4=scan (clientFirstName,4,", ");
	If Fname1='JR' or 'SR' or 'II' or 'III' or length(Fname1)=1 then Fname1=' ';
	If Fname2='JR' or 'SR' or 'II' or 'III' or length(Fname2)=1 then Fname2=' ';
	If Fname3='JR' or 'SR' or 'II' or 'III' or length(Fname3)=1 then Fname3=' ';
	If Fname4='JR' or 'SR' or 'II' or 'III' or length(Fname4)=1 then Fname4=' ';
end;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 20:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372303#M88999</guid>
      <dc:creator>colabear</dc:creator>
      <dc:date>2017-06-30T20:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can I resolve name values and re-assign to the correct fields?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372312#M89005</link>
      <description>&lt;P&gt;What is your question?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 22:02:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372312#M89005</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-06-30T22:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I resolve name values and re-assign to the correct fields?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372320#M89008</link>
      <description>&lt;P&gt;Will your data be matched to a known data set of "clean" values or do you need to clean this without any outside comparison?&lt;/P&gt;
&lt;P&gt;How many records are you dealing with? Some techniques that may work for a couple hundred names in a reasonable amount of time may not work if you're dealing with millions of records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are a number of search and replace function such as TRANWRD, TRANSLATE&amp;nbsp;and COMPRESS&amp;nbsp;that you could use to reduce some of this&lt;/P&gt;
&lt;P&gt;For instanc instead of scanning and looking for JR in mulple places use Tranwrd;&lt;/P&gt;
&lt;PRE&gt;data example;
   name='Smith, John JR';
   cleaname = tranwrd(name,'JR','');
run;&lt;/PRE&gt;
&lt;P&gt;You can use compress to replace some obnoxious characters&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   name= '-Smith, * John !';
   cleanname =  compress(name,'*|-/!');
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jun 2017 23:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372320#M89008</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-06-30T23:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can I resolve name values and re-assign to the correct fields?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372416#M89053</link>
      <description>To retain a good solution that is maintainable (is that word?) over time, you might want to check out SAS Data Management Studio.</description>
      <pubDate>Sat, 01 Jul 2017 14:02:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372416#M89053</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-07-01T14:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can I resolve name values and re-assign to the correct fields?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372717#M89160</link>
      <description>&lt;P&gt;Hi. Thank you for your response. The dataset I'm working with contains 480,000 records. About 10,000 appear to have issues with FN and LN variables having values in the incorrect column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, I am cleaning this dataset so it can be run through a matching program I created. I'll try your suggestions and see what happens.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 12:42:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372717#M89160</guid>
      <dc:creator>colabear</dc:creator>
      <dc:date>2017-07-03T12:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can I resolve name values and re-assign to the correct fields?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372719#M89161</link>
      <description>&lt;P&gt;I am seeking advice on how to clean up the dataset. There are issues with FN and LN values which I need to resolve. The dataset contains 480,000 records. I need assistance finding an effectient code to resolve the issues. I will then be using this dataset to conduct a match through another SAS program.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 12:46:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372719#M89161</guid>
      <dc:creator>colabear</dc:creator>
      <dc:date>2017-07-03T12:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I resolve name values and re-assign to the correct fields?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372784#M89173</link>
      <description>&lt;P&gt;I solved the problem with the following code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data clean_fn;
set testing2b;
last_name = scan(FN,-1,' '); 
mi_name = scan(FN,-2,' ');
first_name = scan(FN,-3,' ');
keep FN LN last_name first_name mi_name;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In this dataset, the FN variable contained first, middle and last name as a value. This worked out very well considering the size of the dataset.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 16:11:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-name-values-and-re-assign-to-the-correct/m-p/372784#M89173</guid>
      <dc:creator>colabear</dc:creator>
      <dc:date>2017-07-03T16:11:48Z</dc:date>
    </item>
  </channel>
</rss>

