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
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).
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).
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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.