Hi Experts,
I have created a stored process with input and output parameters that I'm trying to call using SAS BI Web Services. My endpoint is JSON.
*ProcessBody;
%global BANK
CALCULATIONTYPE
COMPANYID
CUSTOMERID
MODELCODE
PREVIOUSCALCULATIONDATE
PREVIOUSEXPECTEDLOSS
PREVIOUSLOSSGIVENDEFAULT
PREVIOUSPROBABILITYOFDEFAULT
QUESTIONNAIREGRADE;
%STPBEGIN;
* End EG generated code (do not edit this line);
proc printto log=" D:\RiskModels\RestLogs\web_service_test_%sysfunc(today(),yymmdd10.)-%sysfunc(compress(%sysfunc(time( ),time.),":")).log";
run;
libname srcdata "D:\RiskModels\SourceData";
proc sql noprint;
select distinct Client_LGD format=16.8 into :lgd from srcdata.lgd_table where
ID =&customerID;
quit;
%let probabilityOfDefault=0.5;
%let lossGivenDefault = &lgd;
%let expectedLoss = %sysevalf(&lgd. * &probabilityOfDefault.);
* Begin EG generated code (do not edit this line);
;*';*";*/;quit;
%STPEND;
* End EG generated code (do not edit this line);
My output parameters were defined as DOUBLE, but in the response in my API tester tool (POSTMAN for example),
they all show as STRING.
{ "outputParameters": { "expectedLoss": "0.22068032", "probabilityOfDefault": "0.5", "lossGivenDefault": "0.44136064" } }
When I looked in SAS documentation the example shows a response with string variables only.
Does anyone succeed transfer numeric parameters?
https://documentation.sas.com/doc/en/itechcdc/9.4/wbsvcdg/n1wblekhip1yrln1fv2s5b6a2d9f.htm
Thank you very much,
Nufar.
Thank you for your reply @rudfaden .
You are right, proc json would work. But I'm trying to understand if I can use the simple way (defining output parameters in the STP) to send parameters that are not string in my reply. Any luck with that?
Thank you very much,
Nufar.
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 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: