Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google...
Transcript of Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google...
![Page 1: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/1.jpg)
Driving Distances and Times Using SAS® and Google Maps
Mike ZdebUniversity at Albany School of Public Health
![Page 2: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/2.jpg)
# WHY ... STUDY OF MOTHERS ANDINFANTS IN NEW YORK STATE
# 1,000+ MOMS AND THREE CLINICS
# WHICH CLINIC IS CLOSEST TO EACH MOM
# WHAT IS THE DRIVE TIME TO THAT CLINIC
![Page 3: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/3.jpg)
# SATISFIED WITH DISTANCE BETWEEN ZIPCENTROIDS ... NOT USING STREETADDRESS
# USE SASHELP.ZIPCODE TO FIND LATITUDEAND LONGITUDE OF CENTROIDS FORMOMS AND CLINICS
# WHERE ARE CLINICS AND MOMS
![Page 4: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/4.jpg)
![Page 5: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/5.jpg)
# EASY TO CALCULATE STRAIGHT LINEDISTANCE
# FUNCTIONS IN V9.2
GEODIST ... SPECIFY LATITUDE ANDLONGITUDE FOR TWO LOCATIONS
ZIPCITYDISTANCE ... SPECIFY TWO ZIPS(ACCESSES LAT/LONG IN SASHELP.ZIPCODE)
![Page 6: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/6.jpg)
# PRIOR TO V9.2
HAVERSINE FORMULA
"... GREAT‐CIRCLE DISTANCES BETWEEN TWOPOINTS ON A SPHERE FROM THEIRLONGITUDES AND LATITUDES ..."
V9.2 FUNCTIONS USE THE VINCENTYFORMULA (MORE ACCURATE AND MORECOMPLICATED THAN HAVERSINE)
![Page 7: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/7.jpg)
![Page 8: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/8.jpg)
# DRIVING DISTANCE ... 383 MILES# DRIVING TIME ... 6 HOURS 45 MINUTES
![Page 9: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/9.jpg)
# IN DIRECTIONS BOXCLICK ON LINK
# COPY LINK AND IT LOOKS AS FOLLOWS ...
https://maps.google.com/maps?saddr=Albany,+NY&daddr=Toronto,+ON&hl=en&ll=43.237199,‐76.442871&spn=4.554025,7.003784&sll=42.652579,‐73.756232&sspn=0.287351,0.437393&geocode=FaPTigIduJGa‐ylL‐0_MNAreiTHEKOegEmOh4Q%3BFWoYmgIdcLVE‐ymlO8bXkMvUiTF3xLQqUFU1Mg&mra=ls&t=m&z=8
# SHORT URL ... http://goo.gl/maps/w3K3
![Page 10: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/10.jpg)
# MINIMUM INFO FOR GOOGLE MAP
![Page 11: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/11.jpg)
# MORE DETAILS ON THE SAS COMMUNITYWEB SITE ... SEARCH FOR "drivingdistance"
![Page 12: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/12.jpg)
![Page 13: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/13.jpg)
![Page 14: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/14.jpg)
%let ll1=%str(42.73,‐73.80);%let ll2=%str(43.73,‐79.38); * URL access method;filename x url "http://maps.google.com/maps?daddr=&ll2.%nrstr(&saddr)=&ll1";filename z temp; * store web page contents in file TEMP;data _null_;
infile x recfm=f lrecl=1 end=eof; file z recfm=f lrecl=1;input @1 x $char1.; put @1 x $char1.;if eof;call symputx('filesize',_n_);
run;
![Page 15: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/15.jpg)
* find distance and time in file TEMP;data _null_;
infile z recfm=f lrecl=&filesize. eof=done;input @ '<div class="altroute‐rcol altroute‐info"> <span>' @;input text $50.;
distance = input(scan(text,1," "),comma12.);units = scan(text,2,"< ");time = scan(text,5,"<>");
file print;put "DRIVING DISTANCE BETWEEN &ll1 AND &ll2 : " distance units" (TIME: " time ")";stop;
done:file print;put "CANNOT FIND THE DRIVING DISTANCE BETWEEN &ll1 AND &ll2 : " /
"TRY ANOTHER PAIR OF COORDINATES"; stop;
run;
* clear file names;filename x; filename z;
![Page 16: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/16.jpg)
# POSTAL CODES
![Page 17: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/17.jpg)
* enter two zip codes;%let z1=12203;%let z2=M4W1A1; filename x url"http://maps.google.com/maps?daddr=&z2.%nrstr(&saddr)=&z1";filename z temp;
<SAME SAS CODE AS WITH LAT/LONG>
DRIVING DISTANCE BETWEEN 12203 ANDM4W1A1 : 379 mi (TIME: 6 hours 41 mins )
![Page 18: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/18.jpg)
EXAMPLE APPLICATION ... FIND DRIVINGDISTANCE AND TIME TO ZIP 12203 (CITY OFALBANY) FOR POPULATION IN COUNTIES THATSURROUND ALBANY COUNTY
# ZIP 12203 COULD BE THE LOCATION OF AHOSPITAL, STORE, ETC.
![Page 19: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/19.jpg)
![Page 20: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/20.jpg)
# USE SAS AND GOOGLE MAPS TO FINDDRIVING DISTANCE AND TIME
# MERGE DATA WITH ZIP‐SPECIFICPOPULATION DATA
# USE PROC UNIVARIATE TO FINDPERCENTAGE OF POPULATION WITHVARIOUS DISTANCES AND TIMES TO ZIP12203
![Page 21: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/21.jpg)
# 50% OF POPULATION 17.1 MILES AND 23MINUTES FROM ZIP 12203
![Page 22: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/22.jpg)
# Work was funded in part by NIH grantHHSN267200700019C from the EuniceKennedy Shriver National Institute ofChild Health and Human Development
![Page 23: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/23.jpg)
# ANOTHER APPROACH ...
![Page 24: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/24.jpg)
![Page 25: Driving Distances and Times Using SAS and Google Maps Group Presentati… · # use sas and google maps to find driving distance and time # merge data with zip‐specific population](https://reader036.fdocuments.net/reader036/viewer/2022081404/5f0513837e708231d4112441/html5/thumbnails/25.jpg)