BookmarkSubscribeRSS Feed
mcrum1
Calcite | Level 5

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

2 REPLIES 2
FriedEgg
SAS Employee

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

GraphGuy
Meteorite | Level 14

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


cities_near_border.png

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 819 views
  • 0 likes
  • 3 in conversation