BookmarkSubscribeRSS Feed
Agha
Calcite | Level 5

I should calculate the distance between home addresses and closest eye clinic. The addresses are saved in excel. Street, city and state have separate columns. I know I should add double quotation to each part of  the addresses and then find the distance. Can you please share the codes with me. I can not share the addresses with you but they are similar the list below. Thanks.

 

Street                       state           City

aaa bbb ccc             DD             mnv

aa dddd eee            DD              dvu

ffff oo nnm              DD             lmn

5 REPLIES 5
Reeza
Super User

You need an api to get driving distances. If you can use flying distances (straight line distance) then you can use proc geodist and geocode function.

 

Use PROC geocode to convert addresses to latitude and longitude and then the geodist() function to calculate the flying distance. 

 

https://support.sas.com/en/knowledge-base/maps-geocoding/geocodes.html#:~:text=Use%20the%20PROC%20GE....

 

Paper on the topic

https://support.sas.com/resources/papers/proceedings17/0155-2017.pdf

 

Or try this method - note you need the latitude/longitude for this one or need to modify the URL portion.

https://communities.sas.com/t5/SAS-Programming/Find-driving-distance-google-maps-usinga-list-of-10-h...

sbxkoenk
SAS Super FREQ

By the way,
You can also do reverse geocoding in SAS.

 

Home > SAS Communities Library > Reverse Geocoding Using PROC GINSIDE
Reverse Geocoding Using PROC GINSIDE
Started 4 weeks ago | Modified 4 weeks ago
https://communities.sas.com/t5/SAS-Communities-Library/Reverse-Geocoding-Using-PROC-GINSIDE/ta-p/895...

 

BR,
Koen

sbxkoenk
SAS Super FREQ

See here :

BR,
Koen

sbxkoenk
SAS Super FREQ

Home > Programming > Programming >
Re: Find driving distance (google maps) using a list of 10 hospital addresses and individual zipcode
SOLVED topic
https://communities.sas.com/t5/SAS-Programming/Find-driving-distance-google-maps-usinga-list-of-10-h...

 

Koen

ugawoxoto61
Fluorite | Level 6

@Agha wrote:

I should calculate the distance between home addresses and closest eye clinic. The addresses are saved in excel. Street, city and state have separate columns. I know I should add double quotation to each part of  the addresses and then find the distance. Can you please share the codes with me. I can not share the addresses with you but they are similar the list below. Thanks.

 

Street                       state           City

aaa bbb ccc             DD             mnv

aa dddd eee            DD              dvu

ffff oo nnm              DD             lmn

 

When it comes to long drives or even just routine trips, knowing your car's condition is essential for a smooth journey. I’ve learned the hard way how a small issue can turn a trip into a huge headache. One thing I always make sure to do before heading out is check my car’s history to avoid any nasty surprises, like hidden mileage discrepancies. A great tool for this is https://www.faxvin.com/vin-check/mileage, which lets you easily verify a vehicle’s mileage and overall history by just using the VIN. It’s super handy if you're buying a used car or just want to make sure your own vehicle is up to scratch before a long drive. Trust me, knowing these details makes all the difference when you're on the road!


Replace 'your_addresses.xlsx' with the path to your actual Excel file, and ensure the clinic's latitude and longitude are correctly entered.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 4276 views
  • 5 likes
  • 4 in conversation