DATA Step, Macro, Functions and more

rest json data parsing

Reply
Occasional Contributor
Posts: 7

rest json data parsing

Hello Guys,

 

I am running the below process where i am getting error:

 

filename resp temp;

/* Neat service from Open Notify project */
proc http
url="http://api.open-notify.org/astros.json"
method= "GET"
out=resp;
run;

/* Assign a JSON library to the HTTP response */
libname space JSON fileref=resp;

/* Print result, dropping automatic ordinal metadata */
title "Who is in space right now? (as of &sysdate)";
proc print data=space.people (drop=ordinalSmiley Happy;
run;

 

 here is below error message i am getting:

 

32 /* Assign a JSON library to the HTTP response */
33 libname space JSON fileref=resp;
ERROR: The JSON engine cannot be found.
ERROR: Error in the LIBNAME statement.

Super User
Posts: 17,724

Re: rest json data parsing

JSON libname is available as of SAS 9.4 TS1M4

 

Whicj version do you have installed?

Occasional Contributor
Posts: 7

Re: rest json data parsing

I have run the below code on my sas EG

 

proc setinit noalias;
run;

 

Here is the information:

 

Original site validation data
Current version: 9.04.01M3P062415

 

 

Super User
Posts: 17,724

Re: rest json data parsing

That's M3 unfortunately, not M4. 

Occasional Contributor
Posts: 7

Re: rest json data parsing

Hi Reeza,

 

Is there any workarround to do this task in current machine

Super User
Posts: 17,724

Re: rest json data parsing

Not easily. You can get the JSON file but need to manually parse it. 

I believe PROC GROOVY can help with this. 

Or there's a new package in DS2. 

 

The options are illustrated here:

http://blogs.sas.com/content/sasdummy/2015/09/28/parse-json-from-sas/

Ask a Question
Discussion stats
  • 5 replies
  • 98 views
  • 0 likes
  • 2 in conversation