07-07-2015 05:05 PM
I don't know if SAS can do it, but there are tools online that can do it:
You could probably write an algorithm to pass data to the service via the API - $1 per 400 lookups appears to be the rate.
Probably need to investigate the TOS.
07-08-2015 10:20 AM
07-08-2015 10:38 AM
Here is an example using the google geocoding service. It can be adapted for reverse geocoding.
07-08-2015 11:05 AM
09-19-2016 04:08 PM
After much research I landed on a service by TA&M University. You can process batches. I assume this is why you are looking for a SAS solution:
Please let us know if you found a SAS solution. Thanks.
10-25-2016 09:19 AM
Do you need to find the closest street address? ... or would the closest city or zipcode be good enough?
(if the closest city or zipcode is good enough, then I could write some SAS code to do that)
10-25-2016 10:30 AM
Ok - then here's a way to do that, using brute force (and the sashelp.zipcode dataset).
You might refine this to make it a little less code, and more efficient - but I like to take things 1 step at a time, to make it simpler to understand. :-)
input customer_number lat long;
1 35.8227817 -78.755733
2 38.8976398 -77.036627
/* Create all possible pairs of my data, and zipcode lat/longs */
create table pairs as
select unique foo.*, zipcode.zip, zipcode.city, zipcode.x, zipcode.y
from foo, sashelp.zipcode
where zipcode.x^=. and zipcode.y^=.;
/* calculate distance between each customer and each zipcode centroid */
data pairs; set pairs;
Distance = geodist(lat, long, y, x, 'DM');
/* find the closest zipcode to each customer */
proc sort data=pairs out=pairs;
by customer_number distance;
data pairs; set pairs (keep = customer_number lat long zip city);
label zip='Closest Zipcode';
if first.customer_number then output;