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

Distances using non-US Postal Codes

Reply
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.

 

Thanks.

Gaurav

Super User
Posts: 10,496

Re: Distances using non-US Postal Codes

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.

%annomac;
%centroid(InputDS,OutputDS,idvar,SEGONLY=1); 

 

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:

http://support.sas.com/rnd/papers/#2013

PROC GEOCODE: Finding Locations Outside the U.S.

 

Frequent Contributor
Posts: 130

Re: Distances using non-US Postal Codes

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
  • 242 views
  • 0 likes
  • 4 in conversation