<?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: Accessing API with Proc HTTP and Saving Output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Accessing-API-with-Proc-HTTP-and-Saving-Output/m-p/565411#M158738</link>
    <description>&lt;P&gt;It looks like the response is XML, not JSON.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename resp '/home/XXXXXXX/Demo1/demo.xml';

proc http
method="GET"
url="https://rxnav.nlm.nih.gov/REST/ndcstatus?ndc=00093727356/rxnormdata/ndcStatus/allhistoricalndcs"
out=resp;
run;

libname myfiles xml '/home/XXXXXXX/Demo1/demo.xml';

data ndcstatus;
set myfiles.ndcstatus;
run;

proc print;run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/234586"&gt;@A_SAS_Man&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am attempting to pull data from a public API using proc http. I will eventually want to feed a file with multiple values to the API and collect the response, but for now I am just trying to understand the mechanics of accessing it so I'm using a static URL. I'm having trouble figuring out how to view my output below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc http&lt;BR /&gt;method="GET"&lt;BR /&gt;url="https://rxnav.nlm.nih.gov/REST/ndcstatus?ndc=00093727356/rxnormdata/ndcStatus/allhistoricalndcs"&lt;BR /&gt;out=resp;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;This appears to run without error, and as I understand it should generate a .json file, but I'm not sure how I can view that/parse it into something useful. I have been getting information on the API from the following source:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://rxnav.nlm.nih.gov/RxNormAPIs.html#" target="_blank" rel="noopener"&gt;https://rxnav.nlm.nih.gov/RxNormAPIs.html#&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I take my json output (resp) and convert it into a datafile? How can I tell if my call to the API is actually working?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2019 21:21:16 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-06-11T21:21:16Z</dc:date>
    <item>
      <title>Accessing API with Proc HTTP and Saving Output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Accessing-API-with-Proc-HTTP-and-Saving-Output/m-p/565406#M158734</link>
      <description>&lt;P&gt;I am attempting to pull data from a public API using proc http. I will eventually want to feed a file with multiple values to the API and collect the response, but for now I am just trying to understand the mechanics of accessing it so I'm using a static URL. I'm having trouble figuring out how to view my output below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc http&lt;BR /&gt;method="GET"&lt;BR /&gt;url="https://rxnav.nlm.nih.gov/REST/ndcstatus?ndc=00093727356/rxnormdata/ndcStatus/allhistoricalndcs"&lt;BR /&gt;out=resp;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;This appears to run without error, and as I understand it should generate a .json file, but I'm not sure how I can view that/parse it into something useful. I have been getting information on the API from the following source:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://rxnav.nlm.nih.gov/RxNormAPIs.html#" target="_blank"&gt;https://rxnav.nlm.nih.gov/RxNormAPIs.html#&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I take my json output (resp) and convert it into a datafile? How can I tell if my call to the API is actually working?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 21:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Accessing-API-with-Proc-HTTP-and-Saving-Output/m-p/565406#M158734</guid>
      <dc:creator>A_SAS_Man</dc:creator>
      <dc:date>2019-06-11T21:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing API with Proc HTTP and Saving Output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Accessing-API-with-Proc-HTTP-and-Saving-Output/m-p/565411#M158738</link>
      <description>&lt;P&gt;It looks like the response is XML, not JSON.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename resp '/home/XXXXXXX/Demo1/demo.xml';

proc http
method="GET"
url="https://rxnav.nlm.nih.gov/REST/ndcstatus?ndc=00093727356/rxnormdata/ndcStatus/allhistoricalndcs"
out=resp;
run;

libname myfiles xml '/home/XXXXXXX/Demo1/demo.xml';

data ndcstatus;
set myfiles.ndcstatus;
run;

proc print;run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/234586"&gt;@A_SAS_Man&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am attempting to pull data from a public API using proc http. I will eventually want to feed a file with multiple values to the API and collect the response, but for now I am just trying to understand the mechanics of accessing it so I'm using a static URL. I'm having trouble figuring out how to view my output below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc http&lt;BR /&gt;method="GET"&lt;BR /&gt;url="https://rxnav.nlm.nih.gov/REST/ndcstatus?ndc=00093727356/rxnormdata/ndcStatus/allhistoricalndcs"&lt;BR /&gt;out=resp;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;This appears to run without error, and as I understand it should generate a .json file, but I'm not sure how I can view that/parse it into something useful. I have been getting information on the API from the following source:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://rxnav.nlm.nih.gov/RxNormAPIs.html#" target="_blank" rel="noopener"&gt;https://rxnav.nlm.nih.gov/RxNormAPIs.html#&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I take my json output (resp) and convert it into a datafile? How can I tell if my call to the API is actually working?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 21:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Accessing-API-with-Proc-HTTP-and-Saving-Output/m-p/565411#M158738</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-11T21:21:16Z</dc:date>
    </item>
  </channel>
</rss>

