BookmarkSubscribeRSS Feed
BigD
Calcite | Level 5

Hello,

I've been using SAS to scrape a lot of "easy" web sites. Now I have one where I have to submit a location (province) into a form then read in the information. To further complicate matters, the return results are listed say 20 at a time, so I need to span the result pages. The proc http documentations doesn't really help. Anyone have a basic working example I can build on.

Thanks,

Bruce

1 REPLY 1
mich1
Obsidian | Level 7

​Here is an example of a complex API transaction using SAS and PROC HTTP

/*POST A REQUEST FOR SURVEY DATA*/
/****************************************************************************/
/* Qualtrics API Request to get export of survey response data
/****************************************************************************/
filename rsp temp;  
proc http
method= "POST"
in='{"format" : "csv","surveyId" : "yoursurveyID"}'
out=rsp;
headers
"X-API-Token"="yourAPItoken"
"Content-Type"="application/json"
;
run; 
libname RSP JSON fileref=rsp;
 
/*Check Status of request*/
filename dwnld temp;
proc http
method= "GET"
out=dwnld;
headers 
"X-API-Token"="yourAPItoken";
run;
libname dwnld JSON fileref=dwnld;
 
/*Download request - You can view json dwnld for status and filename (same as yourresultID above)*/
filename dwnld '/yourPathHere/GOTDATA';
proc http
method= "GET"
out=dwnld;
headers 
"X-API-Token"="yourAPItoken";
run;
Bread Crumbs and Circuses for All

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 1144 views
  • 0 likes
  • 2 in conversation