<?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: Extracting Data from JSON File from API in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-JSON-File-from-API/m-p/566680#M159297</link>
    <description>&lt;P&gt;When I run your code, there are 4 data tables present in my myFiles library. How many are present for you?&lt;/P&gt;
&lt;P&gt;I can see dates in some of the data sets, specifically the NDCStatus_NDCHistory.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-06-17 at 12.49.32 PM.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30336i3DB46A4405BDD309/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-06-17 at 12.49.32 PM.png" alt="Screen Shot 2019-06-17 at 12.49.32 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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 using the following code to access an API and retrieve some data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename resp 'location/demo.json';

proc http
method="GET"
url="https://rxnav.nlm.nih.gov/REST/ndcstatus.json?ndc=00364666854"
out=resp;
run;

libname myfiles json 'location/demo.json';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I am attempting to get a specific piece of data from this that I can't seem to parse out. When I use the following syntax:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ndcstatus_testing;
set myfiles.ndcstatus;
run;

data ndcstatus_testing_all;
set myfiles.alldata;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It seems as though I am only able to find these two pieces of data, but if I view the json file directly I can see what I'm trying to get at. I am trying to get the "ndcHistory" component of the file, which is also detailed at the following location:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://rxnav.nlm.nih.gov/RxNormAPIs.html#uLink=RxNorm_REST_getNDCStatus" target="_blank" rel="noopener"&gt;https://rxnav.nlm.nih.gov/RxNormAPIs.html#uLink=RxNorm_REST_getNDCStatus&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And below is what I can view in notepad when I open the json file directly.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30334iDDE68E852641629C/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea why I can't seem to get to that piece of data, or how I could resolve it? It should include information like the date for certain codes.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jun 2019 18:52:38 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-06-17T18:52:38Z</dc:date>
    <item>
      <title>Extracting Data from JSON File from API</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-JSON-File-from-API/m-p/566674#M159293</link>
      <description>&lt;P&gt;I am using the following code to access an API and retrieve some data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename resp 'location/demo.json';

proc http
method="GET"
url="https://rxnav.nlm.nih.gov/REST/ndcstatus.json?ndc=00364666854"
out=resp;
run;

libname myfiles json 'location/demo.json';&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But I am attempting to get a specific piece of data from this that I can't seem to parse out. When I use the following syntax:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ndcstatus_testing;
set myfiles.ndcstatus;
run;

data ndcstatus_testing_all;
set myfiles.alldata;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It seems as though I am only able to find these two pieces of data, but if I view the json file directly I can see what I'm trying to get at. I am trying to get the "ndcHistory" component of the file, which is also detailed at the following location:&lt;/P&gt;&lt;P&gt;&lt;A href="https://rxnav.nlm.nih.gov/RxNormAPIs.html#uLink=RxNorm_REST_getNDCStatus" target="_blank" rel="noopener"&gt;https://rxnav.nlm.nih.gov/RxNormAPIs.html#uLink=RxNorm_REST_getNDCStatus&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And below is what I can view in notepad when I open the json file directly.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30334iDDE68E852641629C/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea why I can't seem to get to that piece of data, or how I could resolve it? It should include information like the date for certain codes.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 18:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-JSON-File-from-API/m-p/566674#M159293</guid>
      <dc:creator>A_SAS_Man</dc:creator>
      <dc:date>2019-06-17T18:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Data from JSON File from API</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-JSON-File-from-API/m-p/566680#M159297</link>
      <description>&lt;P&gt;When I run your code, there are 4 data tables present in my myFiles library. How many are present for you?&lt;/P&gt;
&lt;P&gt;I can see dates in some of the data sets, specifically the NDCStatus_NDCHistory.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-06-17 at 12.49.32 PM.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30336i3DB46A4405BDD309/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2019-06-17 at 12.49.32 PM.png" alt="Screen Shot 2019-06-17 at 12.49.32 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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 using the following code to access an API and retrieve some data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename resp 'location/demo.json';

proc http
method="GET"
url="https://rxnav.nlm.nih.gov/REST/ndcstatus.json?ndc=00364666854"
out=resp;
run;

libname myfiles json 'location/demo.json';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I am attempting to get a specific piece of data from this that I can't seem to parse out. When I use the following syntax:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ndcstatus_testing;
set myfiles.ndcstatus;
run;

data ndcstatus_testing_all;
set myfiles.alldata;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It seems as though I am only able to find these two pieces of data, but if I view the json file directly I can see what I'm trying to get at. I am trying to get the "ndcHistory" component of the file, which is also detailed at the following location:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://rxnav.nlm.nih.gov/RxNormAPIs.html#uLink=RxNorm_REST_getNDCStatus" target="_blank" rel="noopener"&gt;https://rxnav.nlm.nih.gov/RxNormAPIs.html#uLink=RxNorm_REST_getNDCStatus&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And below is what I can view in notepad when I open the json file directly.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30334iDDE68E852641629C/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any idea why I can't seem to get to that piece of data, or how I could resolve it? It should include information like the date for certain codes.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 18:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-JSON-File-from-API/m-p/566680#M159297</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-17T18:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Data from JSON File from API</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-JSON-File-from-API/m-p/566681#M159298</link>
      <description>&lt;P&gt;It is there in one of the other datasets.&lt;/P&gt;
&lt;PRE&gt;245   libname resp json ;
NOTE: JSON data is only read once.  To read the JSON again, reassign the JSON LIBNAME.
NOTE: Libref RESP was successfully assigned as follows:
      Engine:        JSON
      Physical Name: C:\Users\XXX\AppData\Local\Temp\1\SAS Temporary
      Files\_TD528_AMRL20L6F1E4992_\#LN00057
246   proc copy inlib=resp outlib=work; run;

NOTE: Copying RESP.ALLDATA to WORK.ALLDATA (memtype=DATA).
NOTE: BUFSIZE is not cloned when copying across different engines. System Option for BUFSIZE was used.
NOTE: There were 21 observations read from the data set RESP.ALLDATA.
NOTE: The data set WORK.ALLDATA has 21 observations and 7 variables.
NOTE: Copying RESP.NDCSTATUS to WORK.NDCSTATUS (memtype=DATA).
NOTE: BUFSIZE is not cloned when copying across different engines. System Option for BUFSIZE was used.
NOTE: There were 1 observations read from the data set RESP.NDCSTATUS.
NOTE: The data set WORK.NDCSTATUS has 1 observations and 11 variables.
NOTE: Copying RESP.NDCSTATUS_NDCHISTORY to WORK.NDCSTATUS_NDCHISTORY (memtype=DATA).
NOTE: BUFSIZE is not cloned when copying across different engines. System Option for BUFSIZE was used.
NOTE: There were 1 observations read from the data set RESP.NDCSTATUS_NDCHISTORY.
NOTE: The data set WORK.NDCSTATUS_NDCHISTORY has 1 observations and 6 variables.
NOTE: Copying RESP.SOURCELIST_SOURCENAME to WORK.SOURCELIST_SOURCENAME (memtype=DATA).
NOTE: BUFSIZE is not cloned when copying across different engines. System Option for BUFSIZE was used.
NOTE: There were 1 observations read from the data set RESP.SOURCELIST_SOURCENAME.
NOTE: The data set WORK.SOURCELIST_SOURCENAME has 1 observations and 6 variables.
NOTE: PROCEDURE COPY used (Total process time):
      real time           0.07 seconds
      cpu time            0.01 seconds
&lt;/PRE&gt;
&lt;PRE&gt;251   data _null_;
252     set ndcstatus_ndchistory;
253     put (_all_) (=/);
254   run;


ordinal_ndcStatus=1
ordinal_ndcHistory=1
activeRxcui=
originalRxcui=312656
startDate=200706
endDate=201101
&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Jun 2019 18:52:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-JSON-File-from-API/m-p/566681#M159298</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-17T18:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Data from JSON File from API</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-JSON-File-from-API/m-p/566684#M159300</link>
      <description>Thank you both, I could not figure out how to view the available files and their names in my setup.</description>
      <pubDate>Mon, 17 Jun 2019 18:58:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-JSON-File-from-API/m-p/566684#M159300</guid>
      <dc:creator>A_SAS_Man</dc:creator>
      <dc:date>2019-06-17T18:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Data from JSON File from API</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-JSON-File-from-API/m-p/566692#M159304</link>
      <description>&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;Thank you both, I could not figure out how to view the available files and their names in my setup.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;PROC CONTENTS&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 19:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extracting-Data-from-JSON-File-from-API/m-p/566692#M159304</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-17T19:19:35Z</dc:date>
    </item>
  </channel>
</rss>

