turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- Driving distance between 2 lat & lon points

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-10-2015 09:23 AM

Hello,

I have to find a way to calculate the actual driving distance not overhead distance but street driving. I'm not sure what the best way to approach this would be.

I did see there is a function called Geodist but I'm not sure if that returns the overhead distance or street driving distance.

I'm using sas 9.4 TS1M2.

Thank you for any help you can give me.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-10-2015 10:04 AM

GEODIST calculates the straight line distance. We do not have anything in SAS that calculates the driving distance.

There are some people who have calculated the driving distance using Google Maps, but this is illegal according to Google.

https://developers.google.com/maps/terms?hl=en (See 10.1.1.H)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-10-2015 10:11 AM

Thank you Darrell.

I have been unable to find anything that I could use just with SAS. I don't want to use a 3rd party site or software due to the sensitivity of my data.

Someone suggested STATA has functions that calculate driving distance so I'm going to look into that. I guess I could calculate it with STATA then bring it back to SAS for the rest of the work.

Thank you again,

Jerry

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-10-2015 10:21 AM

To calculate street distances, you will need a graph that describes the length and connections of the streets.

If you have that, you can use shortest path algoritms to find the distance between 2 points or between set of points.

Shortest path algoritms are available in SAS/OR and SAS/SNA.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-10-2015 11:32 AM

Can you post the reference for how Stata calculates driving distance?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-10-2015 12:00 PM

Hi Reeza,

If I'm able to figure it out I will definitely post it here.

Jerry

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-11-2015 10:25 AM

Hi. The SAS code posted here once worked great, but Google has once again revised their mapping HTML so I'm still working on fixing it ...

**Driving Distances and Drive Times using SAS and Google Maps - sasCommunity**

At the bottom of the web page, there's a link to a paper by Ash Roy and Yingbo Na from the Canadian Institute for Health Information in Torontoi ...

**Batch Production of Driving Distances and Times Using SAS® and Web Map APIs**

**http://support.sas.com/resources/papers/proceedings12/091-2012.pdf**

There's really no reason to bother with a lot of complicated programming since driving time/distance has all been worked out by Google, Mapquest. etc. and I think it would be a lot easier to write SAS code that uses the an API rather than rebuilding the wheel.

ps There's a paper that used the SAS code on the SAS Community site that showed that in many cases, straight line distance (as in the GEODIST function) might suffice ... **A Nationwide Comparison of Driving Distance Versus Straight-Line Distance to Hospitals**

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-11-2015 10:39 AM

I think it's more of an issue that we're usually not allowed to send addresses to the API - especially in health care as it identifies our patients

I've heard of people grabbing a yellow pages and using random address mixed with real addresses to help with the anonymize. An option we use as well is driving distances between zip codes - not as exact but close enough for many endeavors.