11-21-2016 09:21 AM - last edited on 11-21-2016 10:37 AM by ballardw
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.
11-21-2016 10:41 AM
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.
11-22-2016 08:05 AM
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.
11-24-2016 05:54 PM
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.