BookmarkSubscribeRSS Feed
Jagadeesh_babu
Calcite | Level 5

I have some doubt regarding call quad , getting matrix not performed operation.

PROC IML;

USE test2;

READ all var _ALL_ into B;
CLOSE close test2;
csho = B[1,1];
t_debt = B[1,2];
va = B[1,3];
siga = B[1,4];
debt_face = B[1,5];
exp_rf = B[1,6];
rf_net = B[1,7];
exp_divex= B[1,8];
exp_rfex = B[1,9];

x = B[1,10];

lambda = B[1,11];

ext_opt = B[1,12];

ylow = B[1,13];


/* Define the integrand to estimate warrant price eq. 50 */
START FUN(y) GLOBAL (va, rf_net, siga, t_debt, debt_face, csho, x, exp_divex, exp_rf, exp_rfex, lambda, ext_opt, vd, ylow);
IF ext_opt = 0 THEN ext_opt = .0001;
f1d = (y - LOG((debt_face + csho * x)) + (rf_net + 0.5 * siga**2) * ext_opt) / (siga * SQRT(ext_opt));
f2d = f1d - (siga * SQRT(ext_opt)) ;
opt = (EXP(y) * exp_divex * PROBNORM(f1d) - (debt_face + csho * x) * exp_rfex * PROBNORM(f2d)) ;
mu = LOG(va) + (rf_net - 0.5 * siga**2) * t_debt;
sigma = siga * SQRT(t_debt);
a0 = (LOG(debt_face + csho * x) -mu) / sigma;
pdf = EXP(-((y - mu)**2/(2 * sigma**2))) / (SQRT (2 * CONSTANT('PI')) * sigma);
pre = lambda * exp_rf;
int = pre * opt* pdf;
return(int);
finish;
/* SAS does not like very low lower bounds. no value if 2 std below face?
*/
mu = LOG(va) + (rf_net - 0.5 * siga**2) * t_debt;
sigma = siga * SQRT(t_debt);
yhigh = mu + 5 * sigma;
mid = (yhigh + ylow) / 2;
/* interval = ylow||yhigh;*/
%put &ylow;
%put &yhigh;
call quad(z,"START FUN(y) GLOBAL",[1,13]||mu + 5 * sigma) ;

run;

 

z value is not performing please guide me how to proceed.

1 REPLY 1
Rick_SAS
SAS Super FREQ

You are not calling the QUAD routine correctly. See the documentation for examples. The second argument is the name of the function ("FUN") and the third is a two-element vector that gives the endpoints of the domain of integration:

 

call quad(z,"FUN", yLow || yHigh); /* integral on interval [yLow, yHigh] */
print z;

call quad(z,"FUN", {1 13}); /* integral on interval [1, 13] */
print z;

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 1195 views
  • 0 likes
  • 2 in conversation