BookmarkSubscribeRSS Feed
NY
Fluorite | Level 6 NY
Fluorite | Level 6

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 

image.png

 

Thank you very much,

Nufar.

3 REPLIES 3
NY
Fluorite | Level 6 NY
Fluorite | Level 6

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. 

 

rudfaden
Pyrite | Level 9
NO. I do not think that is possible. SAS only have string and number as datatypes.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 979 views
  • 0 likes
  • 2 in conversation