Flagging multiple locations within 100 miles from US Mexico border.

Occasional Contributor
Posts: 13

Flagging multiple locations within 100 miles from US Mexico border.

Hello,

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!

Melanie

Posts: 1,305

Re: Flagging multiple locations within 100 miles from US Mexico border.

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

SAS Employee
Posts: 995

Re: Flagging multiple locations within 100 miles from US Mexico border.

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: