08-10-2015 09:23 AM
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.
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)
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,
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.
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 ...
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
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
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.