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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Dwayne-Dibbley
Calcite | Level 5
Thanks tweaked the code as per the link

off to the next project 🙂

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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