<?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: Insert JSON data from Google Maps's Distance Matrix API in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917734#M361515</link>
    <description>Now that works. So I need to adjust their output before input them inside SAS. Thank you.</description>
    <pubDate>Sat, 24 Feb 2024 13:33:26 GMT</pubDate>
    <dc:creator>adilar39</dc:creator>
    <dc:date>2024-02-24T13:33:26Z</dc:date>
    <item>
      <title>Insert JSON data from Google Maps's Distance Matrix API</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917067#M361235</link>
      <description>&lt;P&gt;Hi, everyone.&lt;/P&gt;
&lt;P&gt;I'd like to ask some question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've read the guide about how to read JSON data in SAS Studio from this post:&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-read-JSON-data-in-SAS/ta-p/849000" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-read-JSON-data-in-SAS/ta-p/849000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I've tried the example there and it works fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I want to try reading data given from Google Maps Distance Matrix API. They gave an example on how their data will be given after user chose the direction, shown here:&lt;BR /&gt;&lt;A href="https://developers.google.com/maps/documentation/distance-matrix/distance-matrix#json_1" target="_blank" rel="noopener"&gt;https://developers.google.com/maps/documentation/distance-matrix/distance-matrix#json_1&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The JSON data would look like this:&lt;/P&gt;
&lt;PRE class="clear-for-copy"&gt;&lt;SPAN class="pun"&gt;{&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"destination_addresses"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="str"&gt;"San Francisco, Californie, États-Unis"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"Victoria, BC, Canada"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;],&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"origin_addresses"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="str"&gt;"Vancouver, BC, Canada"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"Seattle, Washington, États-Unis"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;],&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"rows"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;{&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"elements"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;{&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"distance"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;{&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"text"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"1 712 km"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"value"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;1711765&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"duration"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;{&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"text"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"3 jours 16 heures"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"value"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;318119&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"status"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"OK"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;{&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"distance"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;{&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"text"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"140 km"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"value"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;139695&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"duration"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;{&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"text"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"6 heures 49 minutes"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"value"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;24567&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"status"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"OK"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;],&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;{&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"elements"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;[&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;{&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"distance"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;{&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"text"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"1 452 km"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"value"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;1451704&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"duration"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;{&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"text"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"3 jours 2 heures"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"value"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;266680&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"status"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"OK"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;{&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"distance"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;{&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"text"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"146 km"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"value"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;146500&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"duration"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;{&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"text"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"2 heures 53 minutes"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"value"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;10374&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"status"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"OK"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;],&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;},&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;],&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"status"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;:&lt;/SPAN&gt; &lt;SPAN class="str"&gt;"OK"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;My code look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename location temp;
/* Sample JSON from Google Maps's Distance API Matrix */
data _null_;
 file location;
 infile datalines;
 input;
 put _infile_;
datalines;
{
  "destination_addresses":
    ["San Francisco, Californie, États-Unis", "Victoria, BC, Canada"],
  "origin_addresses":
    ["Vancouver, BC, Canada", "Seattle, Washington, États-Unis"],
  "rows":
    [
      {
        "elements":
          [
            {
              "distance": { "text": "1 712 km", "value": 1711765 },
              "duration": { "text": "3 jours 16 heures", "value": 318119 },
              "status": "OK",
            },
            {
              "distance": { "text": "140 km", "value": 139695 },
              "duration": { "text": "6 heures 49 minutes", "value": 24567 },
              "status": "OK",
            },
          ],
      },
      {
        "elements":
          [
            {
              "distance": { "text": "1 452 km", "value": 1451704 },
              "duration": { "text": "3 jours 2 heures", "value": 266680 },
              "status": "OK",
            },
            {
              "distance": { "text": "146 km", "value": 146500 },
              "duration": { "text": "2 heures 53 minutes", "value": 10374 },
              "status": "OK",
            },
          ],
      },
    ],
  "status": "OK",
}
;
run;

libname data JSON fileref=location;
proc datasets lib=data nolist nodetails;
 contents data=_all_;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Error shown up saying that Object is not complete, even thought there are 40 records were written.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="sasSource"&gt;1 %studio_hide_wrapper;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;83 filename location temp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;84 /* Sample JSON from Google Maps's Distance API Matrix */&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;85 data _null_;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;86 file location;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;87 infile datalines;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;88 input;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;89 put _infile_;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;90 datalines;&lt;/DIV&gt;
&lt;DIV id="sasLogNote1_1708480113893" class="sasNote"&gt;NOTE: The file LOCATION is:&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Filename=/saswork/SAS_workE81900005B44_xxxxx.com/#LN00016,&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Owner Name=it3,Group Name=sasusers,&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Access Permission=-rw-r--r--,&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;Last Modified=21/Februari/2024 08:48:34&lt;/DIV&gt;
&lt;DIV id="sasLogNote2_1708480113893" class="sasNote"&gt;NOTE: &lt;STRONG&gt;40 records were written to the file LOCATION&lt;/STRONG&gt;.&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;The minimum record length was 80.&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;The maximum record length was 80.&lt;/DIV&gt;
&lt;DIV id="sasLogNote3_1708480113893" class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;cpu time 0.01 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;131 ;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;132 run;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;133&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;134 libname data JSON fileref=location;&lt;/DIV&gt;
&lt;DIV id="sasLogNote4_1708480113893" class="sasNote"&gt;NOTE: JSON data is only read once. To read the JSON again, reassign the JSON LIBNAME.&lt;/DIV&gt;
&lt;DIV id="sasLogError1_1708480113893" class="sasError"&gt;ERROR: &lt;STRONG&gt;Invalid JSON in input near line 15 column 14: Object is not complete.&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV id="sasLogError2_1708480113893" class="sasError"&gt;ERROR: Error in the LIBNAME statement.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;135 proc datasets lib=data nolist nodetails;&lt;/DIV&gt;
&lt;DIV id="sasLogError3_1708480113893" class="sasError"&gt;ERROR: Libref DATA is not assigned.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;136 contents data=_all_;&lt;/DIV&gt;
&lt;DIV id="sasLogNote5_1708480113893" class="sasNote"&gt;NOTE: Statements not processed because of errors noted above.&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;137 quit;&lt;/DIV&gt;
&lt;DIV id="sasLogError4_1708480113893" class="sasError"&gt;ERROR: Libref DATA is not assigned.&lt;/DIV&gt;
&lt;DIV id="sasLogNote6_1708480113893" class="sasNote"&gt;NOTE: Statements not processed because of errors noted above.&lt;/DIV&gt;
&lt;DIV id="sasLogNote7_1708480113893" class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;
&lt;DIV id="sasLogNote8_1708480113893" class="sasNote"&gt;NOTE: PROCEDURE DATASETS used (Total process time):&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;cpu time 0.00 seconds&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;138&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;139 %studio_hide_wrapper;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;150&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;151&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;DIV class="sasSource"&gt;Does this mean that data given from Google does not match JSON that can be read by SAS? Or the fault lies in how the code reading the JSON?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;/DIV&gt;</description>
      <pubDate>Wed, 21 Feb 2024 01:57:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917067#M361235</guid>
      <dc:creator>adilar39</dc:creator>
      <dc:date>2024-02-21T01:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Insert JSON data from Google Maps's Distance Matrix API</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917166#M361280</link>
      <description>&lt;P&gt;Google has posted invalid JSON in their example.&amp;nbsp; They have extra commas all over the place which is causing the issue.&amp;nbsp; I assume it is caused by their using that unreadable style where they place the continuation characters (commas in this case) at the END of the line BEFORE instead of at the START of the continuation line where a human could more easily scan for it and fix it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options parmcards=json;
filename json temp;
parmcards4;
{
  "destination_addresses": ["Lexington, MA, USA", "Concord, MA, USA"],
  "origin_addresses": ["Boston, MA, USA", "Charlestown, Boston, MA, USA"],
  "rows":
    [
      {
        "elements":
          [
            {
              "distance": { "text": "33.3 km", "value": 33253 },
              "duration": { "text": "27 mins", "value": 1620 },
              "duration_in_traffic": { "text": "34 mins", "value": 2019 },
              "status": "OK"
            },
            {
              "distance": { "text": "41.5 km", "value": 41491 },
              "duration": { "text": "33 mins", "value": 1981 },
              "duration_in_traffic": { "text": "39 mins", "value": 2342 },
              "status": "OK"
            }
          ]
      },
      {
        "elements":
          [
            {
              "distance": { "text": "31.1 km", "value": 31100 },
              "duration": { "text": "26 mins", "value": 1543 },
              "duration_in_traffic": { "text": "29 mins", "value": 1754 },
              "status": "OK"
            },
            {
              "distance": { "text": "39.3 km", "value": 39338 },
              "duration": { "text": "32 mins", "value": 1904 },
              "duration_in_traffic": { "text": "35 mins", "value": 2077 },
              "status": "OK"
            }
          ]
      }
    ],
  "status": "OK"
}
;;;;

libname json json ;
proc copy inlib=json outlib=work; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Feb 2024 14:46:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917166#M361280</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-21T14:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Insert JSON data from Google Maps's Distance Matrix API</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917734#M361515</link>
      <description>Now that works. So I need to adjust their output before input them inside SAS. Thank you.</description>
      <pubDate>Sat, 24 Feb 2024 13:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917734#M361515</guid>
      <dc:creator>adilar39</dc:creator>
      <dc:date>2024-02-24T13:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Insert JSON data from Google Maps's Distance Matrix API</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917736#M361516</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/407944"&gt;@adilar39&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Now that works. So I need to adjust their output before input them inside SAS. Thank you.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hopefully the mistake is just in the example in the documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you have trouble with the results returned from actual queries?&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2024 15:05:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917736#M361516</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-24T15:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Insert JSON data from Google Maps's Distance Matrix API</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917871#M361562</link>
      <description>&lt;P&gt;We're still in the discussion stage about using Google Maps API with our Google Maps local partner. They recently said that they need to confirm first whether they can provide the result like the example shown in the web. If it's possible, we then would discuss more about the format that can be read by SAS.&lt;BR /&gt;&lt;BR /&gt;I ask here first so that when they can provide it, I would be able to test it immediately.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 07:11:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917871#M361562</guid>
      <dc:creator>adilar39</dc:creator>
      <dc:date>2024-02-26T07:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: Insert JSON data from Google Maps's Distance Matrix API</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917909#M361580</link>
      <description>&lt;P&gt;In the little I have done with that API to get distance estimate I have not needed to actually parse the whole JSON text.&amp;nbsp; Instead I just use normal SAS input functions to find the location where the numbers I want are stored and read them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Typically something like that looks for the keyword of interest and then reads the value that follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile 'json.txt' dlm='[{,: }]' ;
  input @'"duration":'&amp;nbsp;@'"value"'&amp;nbsp;duraction&amp;nbsp;;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Feb 2024 14:26:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Insert-JSON-data-from-Google-Maps-s-Distance-Matrix-API/m-p/917909#M361580</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-26T14:26:27Z</dc:date>
    </item>
  </channel>
</rss>

