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 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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

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