Calculating the distance between ZIP codes


To calculate the distance between two ZIP codes, you can use either the ZIPCITYDISTANCE or GEODIST function.

The ZIPCITYDISTANCE function uses the latitude and longitude values associated with ZIP codes in the SASHELP.ZIPCODE data set to calculate the distance, in miles between two ZIP codes.

For best results, make sure you are using the latest version of the SASHELP.ZIPCODE data set.

For information on updating the SASHELP.ZIPCODE data set, refer to How to replace the Sashelp.Zipcode data set

The GEODIST function calculates the geodetic distance between two latitude and longitude coordinates. The coordinates can be either degrees or radians and results can be calculated in miles or kilometers.

For more information on the GEODIST function, refer to the SAS documentation.