Good morning, I would like to obtain the distance between two zip codes using SAS and Google Maps. I found this link in the community https://communities.sas.com/t5/SAS-Communities-Library/Driving-Distances-and-Drive-Times-using-SAS-and-Google-Maps/ta-p/475839 , however is not working for me. I believe url response is not in the same format that code expects. ¿Can someone please advice me how to fix the query? I have some other questions: 1- Postal Code are not unique, how we can be sure we are querying the correct cities? For example postal code 27513 belongs to Chantada, Lugo, Spain, but also to Cary, NC, US. 2- Is possible to query for different transports: driving, plane, interrail? * enter two zip codes;
%let z1=28001;
%let z2=27513;
* no changes required below this line;
filename x url "https://www.google.com/maps/dir/&z1/&z2/?force=lite";
filename z 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;
data _null_;
infile z recfm=f lrecl=&filesize. eof=done;
input @ 'miles' +(-15) @ '"' distance :comma12. text $30.;
units = scan(text,1,'"');
time = scan(text,3,'"');
file print;
put "DRIVING DISTANCE BETWEEN &z1 AND &z2 : "
distance comma6. +1 units" (TIME: " time ")";
stop;
done:
file print;
put "CANNOT FIND THE DISTANCE OR TIME BETWEEN &z1 AND &z2, TRY ANOTHER COMBINATION";
run;
filename x clear;
filename z clear; Thanks for your help. Best regards
... View more