
| Features: |
PROC FCMP statement option: OUTLIB= OUTARGS statement |
proc fcmp outlib =
sasuser.exsubs.pkt1;
subroutine calc_years(maturity, current_date, years);
outargs years;
years = (maturity - current_date) / 365.25;
endsub;
function garkhprc (type$, buysell$, amount,
E, t, S, rd, rf, sig);
if buysell = "Buy" then sign = 1.;
else do;
if buysell = "Sell" then sign = -1.;
else sign = .;
end;
if type = "Call" then
garkhprc = sign * amount
* garkhptprc (E, t, S, rd, rf, sig);
else do;
if type = "Put" then
garkhprc = sign * amount
* garkhptprc (E, t, S, rd, rf, sig);
else garkhprc = .;
end;
return (garkhprc); endsub;
run;
subroutine calc_years(maturity, current_date, years);
outargs years;
years = (maturity - current_date) / 365.25;
endsub; function garkhprc (type$, buysell$, amount,
E, t, S, rd, rf, sig);
if buysell = "Buy" then sign = 1.;
else do;
if buysell = "Sell" then sign = -1.;
else sign = .;
end;
if type = "Call" then
garkhprc = sign * amount
* garkhptprc (E, t, S, rd, rf, sig);
else do;
if type = "Put" then
garkhprc = sign * amount
* garkhptprc (E, t, S, rd, rf, sig);
else garkhprc = .;
end;