02-03-2016 01:11 PM
I have a list of locations (both US and Mexico locations) that I would like to create a flag if they are within 100 miles from the US Mexico border.
Question 1: Having the addresses of these locations, is there a way to pull all the latitude longitude from my list of locations from Google Maps into SAS?
Question 2: From here, how would I obtain all the longitude latitude locations for the US Mexico border? Or is there a more efficient way of doing this than grabbing the longitudes latitudes of the border?
I would greatly appreciate any help!
02-04-2016 11:29 AM
2. You can use the datasets provided by SAS/Graph for US/Mexico maps. This example here (http://support.sas.com/kb/44/428.html) will give you a method to have the US/Mexico border (approx.).
02-09-2016 02:07 PM
Assuming that your map has somewhat 'dense' points along the border, you could first identify all the map points along the border (by looking for lat/long points that are in both the US map polygon and the Mexico map polygon ... assuming the map is 'topologically correct'), and then you can create a dataset containing every possible combination of map border lat/long points to every city lat/long point, and then use the geodist() function to calculate the distances between all those pairs ... and then take the smallest distance for each city and assume that's how close that city is to the border (at its closest point), and then check to see if that distance is <= 100 miles.
This is a bit involved, therefore I've created a little example to demonstrate: