<?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 do I measure distance between two zipcodes? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-measure-distance-between-two-zipcodes/m-p/683476#M207026</link>
    <description>&lt;P&gt;Please provide more information about "did not work". Show us the log (the entire log for this DATA step, including code, ERRORs, WARNINGs, NOTEs). If there appear to be errors in the output, show us and explain why you think it is not working.&lt;/P&gt;</description>
    <pubDate>Sat, 12 Sep 2020 23:22:48 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-09-12T23:22:48Z</dc:date>
    <item>
      <title>How do I measure distance between two zipcodes?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-measure-distance-between-two-zipcodes/m-p/683474#M207024</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have SAS 9.4.&lt;/P&gt;&lt;P&gt;I am trying to measure the distance between two cities.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have HQ_ZIP variable and Affiliate_ZIP variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example,&amp;nbsp;&lt;/P&gt;&lt;P&gt;HQ_ZIP&amp;nbsp; AFF_ZIP&lt;/P&gt;&lt;P&gt;12345&amp;nbsp; &amp;nbsp; &amp;nbsp;98765&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;34567&amp;nbsp; &amp;nbsp; &amp;nbsp;87654&lt;/P&gt;&lt;P&gt;67890&amp;nbsp; &amp;nbsp; &amp;nbsp;76362&lt;/P&gt;&lt;P&gt;34543&amp;nbsp; &amp;nbsp; &amp;nbsp;65432&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want a new variable that measures the distance between HQ_ZIP and AFF_ZIP&lt;/P&gt;&lt;P&gt;I tried;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; distance = zipcitydistance ( HQ_ZIP, AFF_ZIP)&lt;/P&gt;&lt;P&gt;but it did not work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help would be very appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Sep 2020 23:08:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-measure-distance-between-two-zipcodes/m-p/683474#M207024</guid>
      <dc:creator>pc_21</dc:creator>
      <dc:date>2020-09-12T23:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I measure distance between two zipcodes?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-measure-distance-between-two-zipcodes/m-p/683476#M207026</link>
      <description>&lt;P&gt;Please provide more information about "did not work". Show us the log (the entire log for this DATA step, including code, ERRORs, WARNINGs, NOTEs). If there appear to be errors in the output, show us and explain why you think it is not working.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Sep 2020 23:22:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-measure-distance-between-two-zipcodes/m-p/683476#M207026</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-09-12T23:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I measure distance between two zipcodes?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-measure-distance-between-two-zipcodes/m-p/683478#M207027</link>
      <description>&lt;P&gt;Per the &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n1r333fdkrofhxn10vmhu9bq5m85.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;documentation&lt;/A&gt;, it looks like the ZIPCITYDISTANCE function works for recognized ZIP codes &lt;EM&gt;in the United States&lt;/EM&gt;. Many of those you provided (or made up?) are not in the U.S.&amp;nbsp; The SASHELP.ZIPCODE dataset contains which ZIP codes are valid:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=sashelp.zipcode;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So make sure those that you're using are valid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example that works, using ZIPCITYDISTANCE(), for valid U.S. zip codes:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
    input HQ_ZIP AFF_ZIP;
    datalines;
10001 90001
98101 32789
;
run;

data want;
    set have;
    distance = zipcitydistance(HQ_ZIP, AFF_ZIP);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 12 Sep 2020 23:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-measure-distance-between-two-zipcodes/m-p/683478#M207027</guid>
      <dc:creator>mklangley</dc:creator>
      <dc:date>2020-09-12T23:33:10Z</dc:date>
    </item>
  </channel>
</rss>

