I want to calculate daily the implied volatility for a data set of option chains. I have all necessary data in a dataset with the columns:
OptionID opt_price strike today exp eq_price intrate
The SAS code for the IV is:
options pageno=1 nodate ls=80 ps=64;
proc fcmp;
opt_price=5;
strike=50;
today='20jul2010'd;
exp='21oct2010'd;
eq_price=50;
intrate=.05;
time=exp - today;
array opts[5] initial abconv relconv maxiter status
(.5 .001 1.0e-6 100 -1);
function blksch(strike, time, eq_price, intrate, volty);
return(blkshclprc(strike, time/365.25,
eq_price, intrate, volty));
endsub;
bsvolty=solve("blksch", opts, opt_price, strike,
time, eq_price, intrate, .);
put 'Option Implied Volatility:' bsvolty
'Initial value: ' opts[1]
'Solve status: ' opts[5];
run;
Now, this function somehow does not need sigma. Why?
Second, how can I feed in and output a dataset with option series for a few years? I tried by optionID but I don't know how I feed in the data correctly and then add it in a dataset (new variable called bsvolty.