title: Access URL in SAS and stored data in dataset and JSON file
body: <p>I am trying to access a URL and want to store data into a dataset and output file as JSON..</p>
  
  <p>I just want to fetch URL data and store as a JSON file
  But my question has two part......</p>
  
  <ol>
  <li>If url response data is already as a json format like
  <a href="http://headers.jsontest.com" rel="nofollow">http://headers.jsontest.com</a> then i just use <code>file</code> command and <code>put</code>
  command with <code>json</code> extension </li>
  <li>If the url response data is <code>html tags</code> like any other url data
  then can it be parsed or converted to <code>json</code> format by SAS</li>
  </ol>
  
  <p>I have tried to fetch suppose <a href="http://www.google.com" rel="nofollow">http://www.google.com</a> or <a href="http://headers.jsontest.com" rel="nofollow">http://headers.jsontest.com</a>.... here is my code.....</p>
  
  <pre><code>LIBNAME src '/home/user/readURL';
  filename test_url url 'http://headers.jsontest.com' debug lrecl=8192;
      data src.http;
          infile test_url length=len;
          input record $varying8192. len;
          file '/home/user/readURL/READ_URL.txt';
          put test_url;
      run;
  proc print data = src.http;
  run;
  </code></pre>
  
  <p>This is the log file with error message i got after executing my code : <strong>ERROR: The connection has timed out..</strong> </p>
  
  <p>Any idea how to get rid of this.....</p>
  
  <pre><code>2  The SAS System   07:57 Wednesday, January 15, 2014
  
  16         filename test_url url 'http://headers.jsontest.com' debug lrecl=8192;
  17         data src.http;
  18         infile test_url length=len;
  19         input record $varying8192. len;
  20         run;
  
  ERROR: The connection has timed out..
  NOTE: The SAS System stopped processing this step because of errors.
  NOTE: SAS set option OBS=0 and will continue to check statements. This may cause NOTE: No observations in data set.
  WARNING: The data set SRC.HTTP may be incomplete.  When this step was stopped there were 0 observations and 1 variables.
  WARNING: Data set SRC.HTTP was not replaced because this step was stopped.
  NOTE: DATA statement used (Total process time):
        real time           1:14.92
        cpu time            0.03 seconds
  </code></pre>
  
  <p>and got <code>READ_URL.txt</code> as a blank file</p>
  
  <p>Thanks for any help in advance...</p>