BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Dwayne-Dibbley
Calcite | Level 5

Hi,

 

I have the following code:

 

options NOQUOTELENMAX;

filename usage "/folders/myfolders/sasuser.v94/usage.json";

%let AccessKey = reallylongstring;
	
proc http
 url="https://a.url"
 method="GET" out=usage;
 headers 
   "Authorization"="Bearer &AccessKey.";
run;

libname usage json "/folders/myfolders/sasuser.v94/usage.json";

data usage;
 set usage.data;
run;

proc print data=usage noobs;
run;

is it possible from the proc http to load the json data into the dataset instead of populating a file then loading the dataset from the file?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
DaveHorne
SAS Employee

Hi @Dwayne-Dibbley, it's very doable.  Check out the blog post from @ChrisHemedinger:

https://blogs.sas.com/content/sasdummy/2016/12/02/json-libname-engine-sas/

(I like the "Who is in space right now" example).

 

View solution in original post

3 REPLIES 3
DaveHorne
SAS Employee

Hi @Dwayne-Dibbley, it's very doable.  Check out the blog post from @ChrisHemedinger:

https://blogs.sas.com/content/sasdummy/2016/12/02/json-libname-engine-sas/

(I like the "Who is in space right now" example).

 

ChrisHemedinger
Community Manager

Actually @Dwayne-Dibbley, assuming that the code you shared is working for you, that's exactly how you do it.  The JSON response comes back as a file, and then you use the JSON LIBNAME engine to read it.  It might (logically) contain several data sets that relate to each other, so this additional step is needed for SAS to interpret the data as you need it.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
Dwayne-Dibbley
Calcite | Level 5
Thanks tweaked the code as per the link

off to the next project 🙂

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2742 views
  • 1 like
  • 3 in conversation