<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Driving Distances/Time using SAS and Google Maps in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103321#M21556</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Google the author name, I think they have a personal website where they have an update to this paper that reflects the google changes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Apr 2013 20:20:57 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2013-04-09T20:20:57Z</dc:date>
    <item>
      <title>Driving Distances/Time using SAS and Google Maps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103320#M21555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I seem to be stuck on some coding and was wondering if anyone with some experience in this area can provide some assistance. I am going by Mike Zdeb's paper publish in 2010 (&lt;A href="http://support.sas.com/resources/papers/proceedings10/050-2010.pdf" title="http://support.sas.com/resources/papers/proceedings10/050-2010.pdf"&gt;http://support.sas.com/resources/papers/proceedings10/050-2010.pdf&lt;/A&gt;) showing how to calculate the driving distance and time between two zipcodes using SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried running the code provided in the paper and it didn't seem to work. I have tried troubleshooting it, thinking Google might changed their URL coding somehow and still did not get it to work. Sadly, the code blow did not give me any error messages in the log to try to troubleshooting it.&amp;nbsp; I am unsure how else to modify this to get this code to work. Can someone please provide me with some assistance? Any help would be greatly appreciated!!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have modified the code below to just include only 1 zipcode (&lt;SPAN style="font-family: 'Lucida Grande', Arial, Helvetica, sans-serif; background-color: #ffffff;"&gt;01603&lt;/SPAN&gt;) and I want to calculate it the driving distance of that zipcode to&amp;nbsp; &lt;SPAN style="font-family: 'Lucida Grande', Arial, Helvetica, sans-serif; background-color: #ffffff;"&gt;01605. Eventually I would need to include additional zipcodes (n=200). But I figure I would limit it to one zipcode just to test out the code to make sure it works first.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for your time,&lt;/P&gt;&lt;P&gt;Tan Pham&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;*Calculating driving distances using zipcodes;&lt;/P&gt;
&lt;P&gt;* data set with zip codes;&lt;/P&gt;
&lt;P&gt;data zip_info;&lt;/P&gt;
&lt;P&gt;set sashelp.zipcode;&lt;/P&gt;
&lt;P&gt;where zip=01603 and zip ne 01605 and&lt;/P&gt;
&lt;P&gt;zip_class is missing;&lt;/P&gt;
&lt;P&gt;keep zip;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;* place number of zip in a macro variable;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;call symputx('nzips',obs);&lt;/P&gt;
&lt;P&gt;stop;&lt;/P&gt;
&lt;P&gt;set zip_info nobs=obs;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;* create a macro that contains a loop to access Google Maps multiple time;&lt;/P&gt;
&lt;P&gt;%macro distance_time;&lt;/P&gt;
&lt;P&gt;* delete any data set named DISTANCE_TIME that might exist in the WORK library;&lt;/P&gt;
&lt;P&gt;proc datasets lib=work nolist;&lt;/P&gt;
&lt;P&gt;delete distance_time;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;* read one observation at a time from the data set;&lt;/P&gt;
&lt;P&gt;%do j=1 %to &amp;amp;nzips;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;nrec = &amp;amp;j;&lt;/P&gt;
&lt;P&gt;set zip_info point=nrec;&lt;/P&gt;
&lt;P&gt;call symputx('z2',put(zip,z5.));&lt;/P&gt;
&lt;P&gt;stop;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;* change one zip code in the URL ... zip 12203 is hard-coded as part of the URL;&lt;/P&gt;
&lt;P&gt;filename x url "&lt;A class="jive-link-external-small"&gt;http://maps.google.com/maps?daddr=&amp;amp;z2.%nrstr(&amp;amp;saddr)=01605&lt;/A&gt;";&lt;/P&gt;
&lt;P&gt;data temp;&lt;/P&gt;
&lt;P&gt;retain zip &amp;amp;z2;&lt;/P&gt;
&lt;P&gt;infile x lrecl=32000 pad;&lt;/P&gt;
&lt;P&gt;input;&lt;/P&gt;
&lt;P&gt;loc = find(_infile_,'dditd&amp;gt;');&lt;/P&gt;
&lt;P&gt;if loc ne 0 then do;&lt;/P&gt;
&lt;P&gt;text = substr(_infile_,loc,50);&lt;/P&gt;
&lt;P&gt;text = scan(text,1,'&amp;amp;');&lt;/P&gt;
&lt;P&gt;distance = input(scan(text,-1,'&amp;gt;'),comma12.);&lt;/P&gt;
&lt;P&gt;loc = find(_infile_,'about');&lt;/P&gt;
&lt;P&gt;text = substr(_infile_,loc,50);&lt;/P&gt;
&lt;P&gt;text = scan(text,3,'&amp;lt;&amp;gt;');&lt;/P&gt;
&lt;P&gt;* convert times to seconds;&lt;/P&gt;
&lt;P&gt;select;&lt;/P&gt;
&lt;P&gt;* combine days and hours;&lt;/P&gt;
&lt;P&gt;when (find(text,'day') ne 0) time = 86400*input(scan(text,1,' '),best.) +&lt;/P&gt;
&lt;P&gt;3600*input(scan(text,3,' '),best.);&lt;/P&gt;
&lt;P&gt;* combine hours and minutes;&lt;/P&gt;
&lt;P&gt;when (find(text,'hour') ne 0) time = 3600*input(scan(text,1,' '),best.) +&lt;/P&gt;
&lt;P&gt;60*input(scan(text,3,' '),best.);&lt;/P&gt;
&lt;P&gt;* just minutes;&lt;/P&gt;
&lt;P&gt;otherwise time = 60*input(scan(text,1,' '),best.);&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;output;&lt;/P&gt;
&lt;P&gt;stop;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;keep zip distance time;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;filename x clear;&lt;/P&gt;
&lt;P&gt;* add observation to the final data set;&lt;/P&gt;
&lt;P&gt;proc append base=distance_time data=temp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;* use the macro;&lt;/P&gt;
&lt;P&gt;%distance_time;&lt;/P&gt;


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 20:13:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103320#M21555</guid>
      <dc:creator>Tpham</dc:creator>
      <dc:date>2013-04-09T20:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Driving Distances/Time using SAS and Google Maps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103321#M21556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Google the author name, I think they have a personal website where they have an update to this paper that reflects the google changes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 20:20:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103321#M21556</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-04-09T20:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Driving Distances/Time using SAS and Google Maps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103322#M21557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="814645" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: Mike also has a page on sascommunity.org that describes the method and may be updated:&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://www.sascommunity.org/wiki/Driving_Distances_and_Drive_Times_using_SAS_and_Google_Maps"&gt;http://www.sascommunity.org/wiki/Driving_Distances_and_Drive_Times_using_SAS_and_Google_Maps&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 20:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103322#M21557</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-04-09T20:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Driving Distances/Time using SAS and Google Maps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103323#M21558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for that!&amp;nbsp; I just tried his code on the wiki page and it seem to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 20:59:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103323#M21558</guid>
      <dc:creator>Tpham</dc:creator>
      <dc:date>2013-04-09T20:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Driving Distances/Time using SAS and Google Maps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103324#M21559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I encounter the same problem... I am kind of a beginner in SAS but I was given this task, can you guys please help me out?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I have a data set named "StraightlineDistance.dat" which contains the origin zip codes and destination zip codes (two columns) and I believe I should use the third code in the article on &lt;A href="http://www.sascommunity.org/wiki/Driving_Distances_and_Drive_Times_using_SAS_and_Google_Maps" title="http://www.sascommunity.org/wiki/Driving_Distances_and_Drive_Times_using_SAS_and_Google_Maps"&gt;Driving Distances and Drive Times using SAS and Google Maps - sasCommunity&lt;/A&gt; , which is the situation of multiple zip codes and multiple uses of Google Maps using SAS. I'm not sure which element in the code should be substituted by the element in my data set in order to input the origin and destination zip codes into the code. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Can anybody do me a favor? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Ryan&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 14:24:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103324#M21559</guid>
      <dc:creator>ryan729</dc:creator>
      <dc:date>2014-09-24T14:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Driving Distances/Time using SAS and Google Maps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103325#M21560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You really should post questions as a new discussion/question. However, that said, given the name of your dataset I think all you probably need to read up on can be found at: &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003113156.htm" title="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003113156.htm"&gt;SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 14:43:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103325#M21560</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-09-24T14:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Driving Distances/Time using SAS and Google Maps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103326#M21561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having the same problem that the google map url does not work in my sas program.&amp;nbsp; I tried to use the code in wiki, but it is still not working.&amp;nbsp; I am wondering how finally it works for you.&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2015 19:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103326#M21561</guid>
      <dc:creator>MaxXu</dc:creator>
      <dc:date>2015-05-27T19:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: Driving Distances/Time using SAS and Google Maps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103327#M21562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Keep in mind that all this information goes to Google.&amp;nbsp; If you're a business, your customers might not appreciate you giving their addresses to Google, and if you're a health care provider you might be breaking the law.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 15:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103327#M21562</guid>
      <dc:creator>JackHamilton</dc:creator>
      <dc:date>2015-05-29T15:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Driving Distances/Time using SAS and Google Maps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103328#M21563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Besides the data going to Google, you are not allowed to use any Google service without the data going back on a Google Map.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;See the Terms of Use.&amp;nbsp; &lt;A class="jive-link-external-small active_link" href="https://developers.google.com/maps/terms" style="font-family: inherit; line-height: 1.5em; font-weight: inherit; font-style: inherit; color: #0e66ba;"&gt;https://developers.google.com/maps/terms&lt;/A&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;See section 10.1.1.H about a Google service.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 15:18:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Driving-Distances-Time-using-SAS-and-Google-Maps/m-p/103328#M21563</guid>
      <dc:creator>Darrell_sas</dc:creator>
      <dc:date>2015-06-15T15:18:31Z</dc:date>
    </item>
  </channel>
</rss>

