<?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: Fuzzy match postal codes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Fuzzy-match-postal-codes/m-p/802538#M315944</link>
    <description>Create copies of your Postal codes with 3/4 chars each and for those take the average of the latitude/longitude. &lt;BR /&gt;&lt;BR /&gt;So L1G3H8 becomes L1G3H* and the latitude and longitude are the average of all the 9 postal codes in that list. &lt;BR /&gt;Repeat for 4 characters.&lt;BR /&gt;For 3 characters, that is a Forward Sortation Area (FSA, assuming Canada) and use the FSA centroid list or do the same as above as well. &lt;BR /&gt;&lt;BR /&gt;data codes345;&lt;BR /&gt;set fullCodes;&lt;BR /&gt;output; * 6 characters;&lt;BR /&gt;PC = substr(PC, 1, 5);&lt;BR /&gt;output; *5 characters;&lt;BR /&gt;PC = substr(PC, 1, 4);&lt;BR /&gt;output; *4 characters;&lt;BR /&gt;PC = substr(PC, 1, 3);&lt;BR /&gt;output; *3 characters;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc means data=codes345 noprint mean NWAY;&lt;BR /&gt;class PC;&lt;BR /&gt;var latitude longitude;&lt;BR /&gt;ods output summary=PC_Lookup;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Now use the PC_LOOKUP table to merge with your data.</description>
    <pubDate>Wed, 16 Mar 2022 21:36:10 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-03-16T21:36:10Z</dc:date>
    <item>
      <title>Fuzzy match postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fuzzy-match-postal-codes/m-p/802515#M315938</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking for help matching postal codes. I have a list of postal codes in one table and a list of postal codes and latitude and longitude in another. I need to match the postal codes by either all 6 or the first instance where 5 (or 4 or 3) characters match.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;list of codes
L1G3H8
L1G3J0
L1G3J1
L1G3J2
L1G3J3&lt;/LI-CODE&gt;&lt;LI-CODE lang="sas"&gt;list of codes with lat and long
L1G3J1	43.920899	-78.874794
L1G3J2	43.920732	-78.874717
L1G3J3	43.920354	-78.876291&lt;/LI-CODE&gt;&lt;P&gt;desired result&lt;/P&gt;&lt;LI-CODE lang="sas"&gt;L1G3H8	43.920899	-78.874794
L1G3J0	43.920899	-78.874794
L1G3J1	43.920899	-78.874794
L1G3J2	43.920732	-78.874717
L1G3J3	43.920354	-78.876291&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 18:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fuzzy-match-postal-codes/m-p/802515#M315938</guid>
      <dc:creator>chrishull</dc:creator>
      <dc:date>2022-03-16T18:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: Fuzzy match postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fuzzy-match-postal-codes/m-p/802517#M315939</link>
      <description>&lt;P&gt;What do you mean by&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;the first instance where 5 (or 4 or 3) characters match.&amp;nbsp;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why "first" match?&amp;nbsp; Shouldn't all matching 5 character codes have an equal chance of being randomly selected?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 22:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fuzzy-match-postal-codes/m-p/802517#M315939</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-03-16T22:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Fuzzy match postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fuzzy-match-postal-codes/m-p/802531#M315943</link>
      <description>&lt;P&gt;Start with an exact match on all 6 characters, then with the remaining rows a 5 character match. The problem is that with any matches with less than 6 characters you are not necessarily going to get a unique match. What post code will you choose when there are multiple choices? The first or last sorted value or some other strategy?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 20:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fuzzy-match-postal-codes/m-p/802531#M315943</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-03-16T20:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Fuzzy match postal codes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fuzzy-match-postal-codes/m-p/802538#M315944</link>
      <description>Create copies of your Postal codes with 3/4 chars each and for those take the average of the latitude/longitude. &lt;BR /&gt;&lt;BR /&gt;So L1G3H8 becomes L1G3H* and the latitude and longitude are the average of all the 9 postal codes in that list. &lt;BR /&gt;Repeat for 4 characters.&lt;BR /&gt;For 3 characters, that is a Forward Sortation Area (FSA, assuming Canada) and use the FSA centroid list or do the same as above as well. &lt;BR /&gt;&lt;BR /&gt;data codes345;&lt;BR /&gt;set fullCodes;&lt;BR /&gt;output; * 6 characters;&lt;BR /&gt;PC = substr(PC, 1, 5);&lt;BR /&gt;output; *5 characters;&lt;BR /&gt;PC = substr(PC, 1, 4);&lt;BR /&gt;output; *4 characters;&lt;BR /&gt;PC = substr(PC, 1, 3);&lt;BR /&gt;output; *3 characters;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc means data=codes345 noprint mean NWAY;&lt;BR /&gt;class PC;&lt;BR /&gt;var latitude longitude;&lt;BR /&gt;ods output summary=PC_Lookup;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Now use the PC_LOOKUP table to merge with your data.</description>
      <pubDate>Wed, 16 Mar 2022 21:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fuzzy-match-postal-codes/m-p/802538#M315944</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-03-16T21:36:10Z</dc:date>
    </item>
  </channel>
</rss>

