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
Lapis Lazuli | Level 10
NO. I do not think that is possible. SAS only have string and number as datatypes.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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