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;

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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