Data visualization with SAS programming

Flagging multiple locations within 100 miles from US Mexico border.

Reply
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

Trusted Advisor
Posts: 1,297

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

1. I am pretty sure that Google's terms of use do not allow for this (https://developers.google.com/maps/terms#section_10_12).  There are other webservices that you could use instead.  If you license SAS/Graph, you can also use PROC GEOCODE

 

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: 963

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:

 

http://robslink.com/SAS/democd84/cities_near_border.htm

http://robslink.com/SAS/democd84/cities_near_border_info.htm

 

cities_near_border.png

Attachment
Post a Question
Discussion Stats
  • 2 replies
  • 292 views
  • 0 likes
  • 3 in conversation