<?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: As MERGE function but not exactly, just similar in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398413#M96393</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/107284"&gt;@Angel_Saenz&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;If you've got the SAS Data Quality Server (comes also with offerings like the SAS Data Management bundle I believe) then you could first standardize your addresses and then use these standardized addresses for the merge.&lt;/P&gt;
&lt;P&gt;With the DQ server ("DataFlux") you could also create match codes and then merge over these match codes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With match codes you'll end up with a few wrong matches, which standardized addresses you'll miss a few matches.&lt;/P&gt;</description>
    <pubDate>Sun, 24 Sep 2017 21:29:30 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-09-24T21:29:30Z</dc:date>
    <item>
      <title>As MERGE function but not exactly, just similar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398382#M96370</link>
      <description>&lt;P&gt;&lt;SPAN&gt;How to make a match between two variables similar to the merge but that the condition is that they are not exactly the same, but just similar&lt;/SPAN&gt;?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example I have 2 datasets:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dataset1-var_street&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Manhattan street 1000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dataset2-var_street&lt;/P&gt;&lt;P&gt;Madison 1000&lt;/P&gt;&lt;P&gt;Manhattan st 1000&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Manhattan street 1000&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Manhatan street 1000&lt;/P&gt;&lt;P&gt;Manhattan st. 1000&lt;/P&gt;&lt;P&gt;Moore 1000&lt;/P&gt;&lt;P&gt;Manhattan 1100&lt;/P&gt;&lt;P&gt;Manhattan street 100&lt;/P&gt;&lt;P&gt;Manhattan st. 2000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use MERGE function the result is only one obs:&lt;/P&gt;&lt;P&gt;dataset3-var_street&lt;/P&gt;&lt;P&gt;Manhattan street 1000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I want some like this:&lt;/P&gt;&lt;P&gt;dataset3-var_street&lt;/P&gt;&lt;P&gt;Manhattan st 1000&lt;/P&gt;&lt;P&gt;Manhattan street 1000&lt;/P&gt;&lt;P&gt;Manhatan street 1000&lt;/P&gt;&lt;P&gt;Manhattan st. 1000&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2017 14:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398382#M96370</guid>
      <dc:creator>Angel_Saenz</dc:creator>
      <dc:date>2017-09-24T14:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: As MERGE function but not exactly, just similar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398389#M96374</link>
      <description>&lt;P&gt;Your trying to do a fuzzy match. You can find a number of possibilities searching for that term.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one method. You are looking for low scores, but have to decide how low is still a good match. In your example, 300 or lower would work:&lt;/P&gt;
&lt;PRE&gt;data dataset1;
  informat var_street $100.;
  input var_street &amp;amp; number;
  cards;
Manhattan street  1000
;
 
data dataset2;
  informat var_street $100.;
  input var_street &amp;amp; number;
  cards;
Madison  1000
Manhattan st  1000
Manhattan street  1000
Manhatan street  1000
Manhattan st.  1000
Moore  1000
Manhattan  1100
Manhattan street  100
Manhattan st.  2000
;

/* get number of records in bankinfo dataset */
data _null_;
 if 0 then set dataset2 nobs=nobs;
 call symput('numrec',nobs);
 stop;
run;

data test (keep=var_street number compare_add compare_num score);
  array addresses(&amp;amp;numrec) $100;
  array numbers(&amp;amp;numrec);
  do i=1 to &amp;amp;numrec;
     set dataset2(rename=(var_street=add_check number=num_check));
    addresses(i)=add_check;
    numbers(i)=num_check;
  end;
  do until (eof); 
    set dataset1 end=eof;
    do i=1 to &amp;amp;numrec;
      if number eq numbers(i) then do;
        compare_add=addresses(i);
        compare_num=numbers(i);
        score= compged(var_street,addresses(i));
        output;
      end;
    end;
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2017 15:19:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398389#M96374</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-09-24T15:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: As MERGE function but not exactly, just similar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398413#M96393</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/107284"&gt;@Angel_Saenz&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;If you've got the SAS Data Quality Server (comes also with offerings like the SAS Data Management bundle I believe) then you could first standardize your addresses and then use these standardized addresses for the merge.&lt;/P&gt;
&lt;P&gt;With the DQ server ("DataFlux") you could also create match codes and then merge over these match codes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With match codes you'll end up with a few wrong matches, which standardized addresses you'll miss a few matches.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2017 21:29:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398413#M96393</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-09-24T21:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: As MERGE function but not exactly, just similar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398857#M96515</link>
      <description>GREAT! thank you Art!</description>
      <pubDate>Tue, 26 Sep 2017 16:13:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398857#M96515</guid>
      <dc:creator>Angel_Saenz</dc:creator>
      <dc:date>2017-09-26T16:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: As MERGE function but not exactly, just similar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398938#M96560</link>
      <description>&lt;P&gt;Art, I have one question, what happend if I have more than 1 obs in dataset 1:&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data dataset1;&lt;BR /&gt;&amp;nbsp; informat var_street $100.;&lt;BR /&gt;&amp;nbsp; input var_street &amp;amp; number;&lt;BR /&gt;&amp;nbsp; cards;&lt;BR /&gt;Manhattan street&amp;nbsp; 1000&lt;/P&gt;&lt;P&gt;Moore&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1001&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I want to compare two addresses Manhattan street&amp;nbsp; 1000 and Moore&amp;nbsp;&amp;nbsp; 1001 ?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 20:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398938#M96560</guid>
      <dc:creator>Angel_Saenz</dc:creator>
      <dc:date>2017-09-26T20:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: As MERGE function but not exactly, just similar</title>
      <link>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398944#M96564</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/107284"&gt;@Angel_Saenz&lt;/a&gt;: The code, as is, will accomodate any number of records in either of the two datasets. Until you discover what value provides false positives, you could always sort the resulting file by&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var_street number score&lt;/PRE&gt;
&lt;P&gt;and then, possibly, only keep the record (for each var_street number) with the lowest score.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 20:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/As-MERGE-function-but-not-exactly-just-similar/m-p/398944#M96564</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-09-26T20:52:58Z</dc:date>
    </item>
  </channel>
</rss>

