/* --------------------------------------------------------------------------- $Revision: 1.1.2.11 $ $Date: 2015/07/03 11:35:48 $ NAME: cxt_HTTPRequest.sas TYPE: cmacro DESCRIPTION:macro to call proc http SAS VERSION: 9.4 INPUT:proc http input parameters OUTPUT: header out file CALLS: CALLED BY (optional): PRECONDITIONS (optional): POSTCONDITIONS (optional): HISTORY: userid yyyymmdd defectid desc sinshd 20140808 ------------------------------------------------------------------------------ Copyright (c) 2005-2015, SAS Institute Inc., Cary, NC, USA, All Rights Reserved ------------------------------------------------------------------------------ */ %macro cxt_HTTPRequest( infile=, outfile=, headerin=, headerout=, requestCT=, requestURL=, requestMethod=, service_auth=, proxy_host=, proxy_port=, proxy_auth= ); /* disable quote warnings */ options NOQUOTELENMAX; proc http %if &infile ne %then %do; in=&infile %end; %if &outfile ne %then %do; out=&outfile %end; %if &headerin ne %then %do; headerin=&headerin %end; %if &headerout ne %then %do; headerout=&headerout /* S1155235 S1167959 HEADEROUT_OVERWRITE option required in 94M3 to avoid multiple return status codes */ HEADEROUT_OVERWRITE %end; %if &service_auth ne %then %do; CLEAR_CONN_CACHE NO_COOKIES NO_CONN_CACHE AUTH_BASIC &service_auth %end; %if &requestCT ne %then %do; ct="&requestCT ; charset=utf-8" %end; /* need proxy ? */ %if (%length(&proxy_host) > 0 and %length(&proxy_port) > 0) %then %do; proxyhost="&proxy_host" proxyport=&proxy_port /* proxy with auth ?*/ %if &proxy_auth ne %then %do; &proxy_auth %end; %end; method="&requestMethod" url="%superq(requestURL)" ; run; %* Check proc http execution status ; %if &SYSERR. > 4 %then %do; %put &SYSERRORTEXT. ; %let retcode=1; %let errmsg=%sysfunc(sasmsg(&msg_dset,_cxa_norm_01_err,noquote,&requestMethod)); %let typemsg = %sysfunc(sasmsg(&msg_dset,_cxaerrmsg_label,noquote)); %end; %mend;