Learning SAS? Welcome to the exclusive online community for all SAS learners.

Distances using non-US Postal Codes

Occasional Contributor
Posts: 9

Distances using non-US Postal Codes

[ Edited ]

I need to calculate distances between two points using Zip Codes and Country Code. I don't have the latitude and the longitude of the place. Is there any option available or even possible?


PS: The data is not isolated to USA - so proc geocode etc. wouldn't work.




Super User
Posts: 13,523

Re: Distances using non-US Postal Codes

Posted in reply to gaurav_248

It may help resolve your issues if you could list the countries of interest.

In effect you are asking if there are data sources that have latitude and longitude of (center?) postal code areas by country. That would allow you get the coordinates and then use the GEODIST function.

SAS Employee
Posts: 170

Re: Distances using non-US Postal Codes

You can get the center (centroid) of a country by using the MAPSGFK map data sets (Lat and Long are the unprojected coordinates) and using the %CENTROID macro.  Note, you will have to use the country level maps and many maps are at the "county" level.



SASHELP.ZIPCODE is US only ZIP Code centroids.  Look at the documentation for PROC GEOCODE to find information about UK, Australian and Canadian Postal Codes.  A paper on this is at:


PROC GEOCODE: Finding Locations Outside the U.S.


Frequent Contributor
Posts: 136

Re: Distances using non-US Postal Codes

Posted in reply to Darrell_sas

Credit to Darrell and SAS for drawing our attention to yet another great resource - that paper is quite helpful and comprehensive. I've done a fair bit of this type of work in SAS in Australia and New Zealand and all I can add is that you can generally buy databases for geoharmonizing servers for developed- and some developing- countries from which you could generate the zipcode centroids via the methods mentioned in the paper. However this would likely be prohibitively expensive unless your project has a large budget. On top of that you would encounter the problem of transcoding once you step outside the roman character language cultures and countries.   

Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation