Hello,
I am a new user of proc http in SAS.
I have tried the code below and it works
options set=SSLREQCERT="allow";
filename resp temp;
PROC HTTP
METHOD="GET"
URL= 'https://ca1.qualtrics.com/API/v3/surveys'
OUT=resp;
headers
'x-api-token'= '***************ddssXDlLVfJUwJOJfD74l0sc1';
run;
/* Let the JSON engine do its thing */
libname posts JSON fileref=resp;
title "Automap of JSON data";
/* examine resulting tables/structure */
proc datasets lib=posts; quit;
proc print data=posts.alldata; run;
data Basic_survey_info (drop=ordinal_result ordinal_elements);
set posts.result_elements;
obs=ordinal_elements;
run;
From the table Basic_Survey_info, one of the survey id is equal to SV_ahhZznQMwSAyrGK
With this information I would like to execute the script below but in SAS. How to do that ?
options set=SSLREQCERT="allow";
filename resp TEMP;
%let SurveyId=SV_ahhZznQMwSAyrGK;
proc http
url="https://ca1.qualtrics.com/API/v3/surveys/&SurveyId./export-responses"
out=resp;
headers
'x-api-token'= '***********ssXDlLVfJUwJOJfD74l0sc1'
'Content-Type'='application/json';
run;
but I am strill getting an error 404I would start with using POST vs GET in your call.
Some sample code:
filename resp temp;
filename outPP temp;
filename sasPgm 'C:\repos\StoredPrograms\DemoStoredProgram.sas';
/*===================================================================== ;
* Executes SAS code
* curl -X POST "http://ina-442tdh2.acmeinc.com:9000/Sas/ExecuteSasProgramFile?
* sasMachine=Any&email=alan.churchill%40acmeinc.com"
* -H "accept: text/plain"
* -H "Content-Type: multipart/form-data"
* -F "sasFile=@DemoStoredProgram.sas;type=application/x-sas"
*=====================================================================*/ ;
proc http
url = 'http://ina-442tdh2.acmeinc.com:9000/Sas/ExecuteSasProgramFile?sasMachine=Any&email=alan.churchill%40...'
method="POST"
in = sasPgm
ct = "multipart/form-data"
;
headers "Accept"="text/plain"
;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.