This is another version to calculate the
implied bolatility until the put option
price issame to opt_price(open markets price);
but this way only use to SAS 9.2:
data data1;
input eq_price strike time opt_price intrate;
datalines;
1108.48 995 0.041067762 0.8 0.01107094
1122.22 995 0.032854209 0.35 0.011018561
1123.67 995 0.030116359 0.3 0.01098864
1126.33 995 0.027378508 0.2 0.01092533
1131.92 995 0.024640657 0.2 0.010853256
1121.86 995 0.021902806 0.175 0.0108289
1127.23 995 0.013689254 0.075 0.010809861
1121.22 995 0.010951403 0.1 0.010954211
1122.22 1010 0.128678987 3.5 0.011561104
1123.67 1010 0.125941136 3 0.011490423
1126.33 1010 0.123203285 2.4 0.011465478
1131.92 1010 0.120465435 2.4 0.011459139
1121.86 1010 0.117727584 3.1 0.011313808
1127.23 1010 0.109514031 2.45 0.011324488
1121.22 1010 0.106776181 2.9 0.011172599
;
run;
proc fcmp outlib=work.functions.samples;
function blksch( strike, time, eq_price, intrate, volty );
return (blkshptprc( strike, time,eq_price, intrate, volty ));
endsub;
run;
options cmplib=work.functions.samples;
proc fcmp outlib=work.functions.samples;
function impl_volty( opt_price, strike, time, eq_price, intrate);
array opts[5] initial abconv relconv maxiter
( .5 .001 1.0e-6 100 ) ;
bsvolty = solve( "blksch", opts, opt_price, strike,
time, eq_price, intrate, .);
return (bsvolty);
put 'Option Implied Volatility:' bsvolty
'Initial value: ' opts[1]
'Solve status: ' opts[5];
endsub;
run;
data data2;
set data1;
implty=impl_volty(opt_price, strike, time, eq_price, intrate);
run;
In this version, I use B-S model to
find the answer of implied bolatility,
but,B-S model have function
"blkshptprc( strike, time,eq_price, intrate, volty )"
in SAS, and B-S model only use
to price the euro options.
In my macro prblem, the price of option is
America options, it can not use B-S model,
it must use binomial method to price. i did
not find the function of "Binomial method "
in SAS , so i use macro to calculat the
America put price.
Finally, i need help to slove this problem for any way!
THX!
Message was edited by: nolonglove
Message was edited by: nolonglove
Message was edited by: nolonglove