Hi,
I am new to proc iml. I read that froot function could replicate excel sovler. I try to solve an equation towards the variable x, which is supposed to a number between -1 and 1, but I got the error: invalid Operation. I am guessing I put in the wrong bound. Could someone please help me with this Problem?
Many thanks!
Best
data have;
input D0 D1 D2 D3;
ZERO = 0;
ID = _N_;
datalines;
0.1 0.45 100 80
0.05 0.5 200 150
0.3 0.45 300 180
0.5 0.6 400 200
0.15 0.6 500 200
;
run;
proc iml;
start Func (x) global (D0, D1, D2, D3);
return ((CDF('NORMAL',(Quantile('NORMAL',D1) + sqrt(x)*Quantile('NORMAL', .999))/sqrt(1-x), 0, 1)-D0)*D1*D2 - D3);
finish;
use have;
read all var {D0 D1 D2 D3} into D;
close;
x=j(nrow(D),1);
do i=1 to nrow(D);
D0= D[i,1]; D1= D[i, 2]; D2 = D[i, 3]; D4 =D[i,4];
x[i]=froot("Func", {-1,1});
end;
print x;
... View more