<?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 JSON Libname in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/JSON-Libname/m-p/370999#M88618</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why Am I having this error on my JSON libname:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Invalid JSON in input near line 1 column 1: Encountered an illegal character.&lt;/P&gt;&lt;P&gt;ERROR: Error in the LIBNAME statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;json&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'C:\Users\GARCIAAV\Dropbox\JSON\test.json'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;pretty&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;export&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; sashelp.class (where=(age=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;12&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;filename&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; help &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;temp&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;/* Neat service from Open Notify project */&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;http&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;/* url="&lt;A href="http://api.open-notify.org/astros.json%22*/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://api.open-notify.org/astros.json"*/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;url=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"&lt;A href="https://www.dropbox.com/home/JSON?preview=test.json" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;FONT color="#0066cc"&gt;https://www.dropbox.com/home/JSON?preview=test.json&lt;/FONT&gt;&lt;/A&gt;"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;method= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"GET"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;out=help;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;/* Assign a JSON library to the HTTP response */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;libname&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test JSON fileref=help;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Thanks,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Ave&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jun 2017 16:48:41 GMT</pubDate>
    <dc:creator>AJDELACRUZ0220</dc:creator>
    <dc:date>2017-06-27T16:48:41Z</dc:date>
    <item>
      <title>JSON Libname</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-Libname/m-p/370999#M88618</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why Am I having this error on my JSON libname:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Invalid JSON in input near line 1 column 1: Encountered an illegal character.&lt;/P&gt;&lt;P&gt;ERROR: Error in the LIBNAME statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;json&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'C:\Users\GARCIAAV\Dropbox\JSON\test.json'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;pretty&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;export&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; sashelp.class (where=(age=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;12&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;filename&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; help &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;temp&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;/* Neat service from Open Notify project */&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;http&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;/* url="&lt;A href="http://api.open-notify.org/astros.json%22*/" target="_blank" rel="nofollow noopener noreferrer"&gt;http://api.open-notify.org/astros.json"*/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;url=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"&lt;A href="https://www.dropbox.com/home/JSON?preview=test.json" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;FONT color="#0066cc"&gt;https://www.dropbox.com/home/JSON?preview=test.json&lt;/FONT&gt;&lt;/A&gt;"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;method= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"GET"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;out=help;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;/* Assign a JSON library to the HTTP response */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;libname&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; test JSON fileref=help;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Thanks,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Ave&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 16:48:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-Libname/m-p/370999#M88618</guid>
      <dc:creator>AJDELACRUZ0220</dc:creator>
      <dc:date>2017-06-27T16:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: JSON Libname</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-Libname/m-p/371001#M88619</link>
      <description>&lt;P&gt;If I understand your test correctly, you're testing a "round trip" of PROC JSON to the JSON libname. &amp;nbsp;By reading the result from Dropbox, you'll need to provide a URL to the "raw" view of the Dropbox file. &amp;nbsp;The link you're using goes to a web page that presents a preview of the file, but&amp;nbsp;&lt;STRONG&gt;does not&lt;/STRONG&gt; serve up the file itself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See &lt;A href="http://blogs.sas.com/content/sasdummy/2012/12/18/using-sas-to-access-data-stored-on-dropbox/" target="_self"&gt;my blog post about using SAS to read from Dropbox&lt;/A&gt;. &amp;nbsp;You'll have to get the "direct file" link from your Dropbox view.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 16:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-Libname/m-p/371001#M88619</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-06-27T16:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: JSON Libname</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-Libname/m-p/371007#M88621</link>
      <description>&lt;P&gt;Thank you for your reply and I apologize for if I am not clear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I really want to do is to import JSON file to SAS using JSON libname. If I have my JSON file in my local directory, what will be the syntax that I need to used?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2017 17:26:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-Libname/m-p/371007#M88621</guid>
      <dc:creator>AJDELACRUZ0220</dc:creator>
      <dc:date>2017-06-27T17:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: JSON Libname</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-Libname/m-p/371033#M88627</link>
      <description>&lt;P&gt;If you have the JSON file locally, you simply assign a SAS fileref with the FILENAME statement to that location. &amp;nbsp;No need to jump through the PROC HTTP hoops. &amp;nbsp;That's only for retrieving JSON data from a web service. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example. &amp;nbsp;Adjust the file paths for your system.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create a JSON file */
proc json out="c:\temp\test.json" pretty;
 export sashelp.class (where=(age=12));
run;

/* Reference the JSON file and read it in using JSON libname */
filename testjs "c:\temp\test.json";
libname test JSON fileref=testjs;

proc datasets lib=test;
quit;

proc print data=test.sastabledata_class;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Jun 2017 19:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-Libname/m-p/371033#M88627</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2017-06-27T19:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: JSON Libname</title>
      <link>https://communities.sas.com/t5/SAS-Programming/JSON-Libname/m-p/373012#M89224</link>
      <description>&lt;P&gt;this perfectly worked! thank you so much!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2017 14:15:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/JSON-Libname/m-p/373012#M89224</guid>
      <dc:creator>AJDELACRUZ0220</dc:creator>
      <dc:date>2017-07-04T14:15:11Z</dc:date>
    </item>
  </channel>
</rss>

