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

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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
  • 948 views
  • 0 likes
  • 2 in conversation