<?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 Distance and travel time between two zip code, a follow-up question- Thanks! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Distance-and-travel-time-between-two-zip-code-a-follow-up/m-p/833380#M329436</link>
    <description>&lt;P&gt;Hello SAS experts,&lt;/P&gt;&lt;P&gt;I encountered 3 quick questions regarding distance/travel time&amp;nbsp; between two zip codes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;zipcitydistance is helpful to calculate the distances between two groups easily. However, I didn't find the code that could give me the travel time.&lt;/P&gt;&lt;P&gt;Is there a convenient way to calculate the travel time between two zip codes?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Is there a limit sample to calculate the distance of two zip codes?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got some error like below when running big datasets.&lt;/P&gt;&lt;P&gt;WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed.&lt;BR /&gt;NOTE: The DATA step has been abnormally terminated.&lt;BR /&gt;NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to missing values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3.&amp;nbsp; Why the results of the distance is different than I put the zip code in other website individually?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&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;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chimei0403_0-1663175072049.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75243i59166BCB1E88F529/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chimei0403_0-1663175072049.png" alt="chimei0403_0-1663175072049.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can see the distance between zip 10001 and zip 9001 is 2454.1.&lt;/P&gt;&lt;P&gt;But if I put those zip codes to&amp;nbsp; this website,&amp;nbsp;&lt;A href="https://www.zipcodesoft.com/distance-between-zip-codes" target="_blank"&gt;https://www.zipcodesoft.com/distance-between-zip-codes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I got something like close to 2448.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chimei0403_1-1663175321741.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75244i60A33AEAEB9B59BE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chimei0403_1-1663175321741.png" alt="chimei0403_1-1663175321741.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know which to follow.&lt;/P&gt;&lt;P&gt;Is there a simple way to calculate road distance of the two zip codes?&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Sep 2022 17:08:54 GMT</pubDate>
    <dc:creator>chimei0403</dc:creator>
    <dc:date>2022-09-14T17:08:54Z</dc:date>
    <item>
      <title>Distance and travel time between two zip code, a follow-up question- Thanks!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Distance-and-travel-time-between-two-zip-code-a-follow-up/m-p/833380#M329436</link>
      <description>&lt;P&gt;Hello SAS experts,&lt;/P&gt;&lt;P&gt;I encountered 3 quick questions regarding distance/travel time&amp;nbsp; between two zip codes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;zipcitydistance is helpful to calculate the distances between two groups easily. However, I didn't find the code that could give me the travel time.&lt;/P&gt;&lt;P&gt;Is there a convenient way to calculate the travel time between two zip codes?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Is there a limit sample to calculate the distance of two zip codes?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got some error like below when running big datasets.&lt;/P&gt;&lt;P&gt;WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed.&lt;BR /&gt;NOTE: The DATA step has been abnormally terminated.&lt;BR /&gt;NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to missing values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3.&amp;nbsp; Why the results of the distance is different than I put the zip code in other website individually?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&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;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chimei0403_0-1663175072049.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75243i59166BCB1E88F529/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chimei0403_0-1663175072049.png" alt="chimei0403_0-1663175072049.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can see the distance between zip 10001 and zip 9001 is 2454.1.&lt;/P&gt;&lt;P&gt;But if I put those zip codes to&amp;nbsp; this website,&amp;nbsp;&lt;A href="https://www.zipcodesoft.com/distance-between-zip-codes" target="_blank"&gt;https://www.zipcodesoft.com/distance-between-zip-codes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I got something like close to 2448.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chimei0403_1-1663175321741.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75244i60A33AEAEB9B59BE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chimei0403_1-1663175321741.png" alt="chimei0403_1-1663175321741.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know which to follow.&lt;/P&gt;&lt;P&gt;Is there a simple way to calculate road distance of the two zip codes?&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 17:08:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Distance-and-travel-time-between-two-zip-code-a-follow-up/m-p/833380#M329436</guid>
      <dc:creator>chimei0403</dc:creator>
      <dc:date>2022-09-14T17:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Distance and travel time between two zip code, a follow-up question- Thanks!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Distance-and-travel-time-between-two-zip-code-a-follow-up/m-p/833470#M329484</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/424555"&gt;@chimei0403&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello SAS experts,&lt;/P&gt;
&lt;P&gt;I encountered 3 quick questions regarding distance/travel time&amp;nbsp; between two zip codes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp;zipcitydistance is helpful to calculate the distances between two groups easily. However, I didn't find the code that could give me the travel time.&lt;/P&gt;
&lt;P&gt;Is there a convenient way to calculate the travel time between two zip codes?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Is there a limit sample to calculate the distance of two zip codes?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got some error like below when running big datasets.&lt;/P&gt;
&lt;P&gt;WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed.&lt;BR /&gt;NOTE: The DATA step has been abnormally terminated.&lt;BR /&gt;NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to missing values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3.&amp;nbsp; Why the results of the distance is different than I put the zip code in other website individually?&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Travel time would require data on connections via the mode of travel (e.g. a map of all roads).&amp;nbsp; This is most certainly NOT in the sas library.&amp;nbsp; The zipcitydistance function uses the &lt;EM&gt;&lt;STRONG&gt;sashelp.zipcode&lt;/STRONG&gt;&lt;/EM&gt; data, which will provide zip code centroids.&amp;nbsp; That's good enough for distances as the bird flies, but not distance (and therefore travel time) via a network of roads.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;You can probably increase the ERRORS limit, but it's more important to find out WHY you're getting errors.&amp;nbsp; Namely look at the code in the locations pointed out by the note on the log.&amp;nbsp; Show us the code, and the log it generates, to get more useful help/&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Distance can be different if the various sources use different zip code data.&amp;nbsp; SAS uses the zip code centroids in sashelp.zipcode.&amp;nbsp; But the others may use slightly different centroid values - or may choose to use some other two-dimensional point for each zip code.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 15 Sep 2022 01:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Distance-and-travel-time-between-two-zip-code-a-follow-up/m-p/833470#M329484</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-09-15T01:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Distance and travel time between two zip code, a follow-up question- Thanks!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Distance-and-travel-time-between-two-zip-code-a-follow-up/m-p/833501#M329493</link>
      <description>&lt;P&gt;If you are getting errors from the ZIPCITYDISTANCE function it means that either one, or both, Zip codes is missing or invalid.&lt;/P&gt;
&lt;P&gt;For this function Zip+4 codes are "invalid" because the Sashelp.zipcode data set does not have centroids for the +4 versions.&lt;/P&gt;
&lt;P&gt;This is clear with this example:&lt;/P&gt;
&lt;PRE&gt;225  data example;
226     x1= zipcitydistance('83701','83704');
227     x2= zipcitydistance('83701','83704-1069');
228  run;

NOTE: Invalid argument to function ZIPCITYDISTANCE('83701','83704-1069') at line 227 column 8.
x1=1.3 x2=. _ERROR_=1 _N_=1
&lt;/PRE&gt;
&lt;P&gt;If you have real data like I get then Zip codes can have too many digits, missing digits, typos reversing digits which often are invalid but not always, or characters other than digits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your errors do not include ZIPCITYDISTANCE then you need to provide the entire log from your code. Copy the text from the log, open a text box on the forum using the &amp;lt;/&amp;gt; icon that appears above the message window and paste in the box. It should look like my example above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Do note that the documentation for the function states:&lt;/P&gt;
&lt;DIV class="xis-refDictEntry"&gt;
&lt;DIV class="xis-details"&gt;
&lt;DIV id="p04i8tllbp6yi9n1wiicckbualvg" class="xis-topicContent"&gt;
&lt;DIV id="p0526ai61vinhjn16k0835lbm34s" class="xis-paragraph"&gt;The &lt;FONT style="background-color: #fcdec0;"&gt;ZIPCITYDISTANCE&lt;/FONT&gt; function returns the geodetic distance in miles between two ZIP code locations. The centroid of each ZIP code is used in the calculation.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;using this definition for Geodetic:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;the shortest line that can be drawn between two points on the elipsoidal surface of the earth; a curve drawn on any given surface so that the osculating plane of the curve at every point shall contain the normal to the surface; the minimum line that can be drawn on any surface between any two points.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 06:12:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Distance-and-travel-time-between-two-zip-code-a-follow-up/m-p/833501#M329493</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-09-15T06:12:02Z</dc:date>
    </item>
  </channel>
</rss>

