Hi:
Apparently, in SAS 9.2, there will be a Black-Scholes function.
http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a002979681.htm
Until then, depending on who you got this program from, this might be performing the right calculation for you.
In brief, this is a DATA step program. It is creating a SAS data set called WORK.BS. The program is reading "raw" data that comes after the
cards; statement -- what you see in the INPUT statement are the variables or columns being read...and in what order.
So, you have this INPUT statement:
input S X r v T;
and if you substitute the LABEL statement meanings for the single letters, what is being read is:
Spot Price ... Strike Price ... Risk Free Rate.... Volatility.... Time Periods
It looks like d1 and d2 are being used to hold values used in the calculation of BS Call Price (C) and BS Put Price (P). The 4 statements after the input statement will be executed for each row of "raw" data that you type or enter in the "cards;" section. The whole program, data included, starts with the keyword DATA and ends with the semi-colon at the bottom of the data. The "program code" portion starts with the keyword data and ends at the CARDS statement. The 'raw" data portion starts with the CARDS; statement and the "raw" data ends with the single semi-colon after the last line of data--but the step boundary for the program happens when the PROC PRINT is encountered. The PROC PRINT is a SAS procedure that is just printing out the SAS dataset WORK.BS -- the most recently created data set.
To find out what/how D1, D2, C and P are calculated, you need to look up functions ... for example, d1 uses 2 functions -- the LOG function and the SQRT function (I added some white space to make the formula easier to follow):
[pre]
d1 = ( log(S/X) + (r + v**2/2 ) *T ) / v / sqrt(T);
[/pre]
To understand the DATA step and what it's doing, reading the SAS basic concepts section of the documentation would be a help. To understand the math behind the Black-Scholes model, I'd guess you have to look at Finance textbooks or Stat textbooks. SAS Tech Support can also help you with the program or making modifications to the program, if it is not calculating according to the kind of analysis you need to do.
cynthia