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.

Become an Explorer! Join SAS Analytics Explorers to learn and complete challenges that earn rewards!
Dwayne-Dibbley
Calcite | Level 5
Thanks tweaked the code as per the link

off to the next project 🙂

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore 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
  • 4861 views
  • 1 like
  • 3 in conversation