turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- calculate implied volatillity by Black-Schole mode...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-12-2011 06:47 AM

i want to calculate implied volatility using proc NLP

the code is like following

proc nlp data=AA outest=BB;

min error ;

PARMS sig=0.01;

d1=(log(SPXclose/(strike_price/1000))+(rate+((sig**2)/2))*TTM)/(sig*sqrt(TTM));

d2=d1-(sig*sqrt(TTM));

ee=((strike_price/1000)*exp((-rate)*TTM)*probnorm(-d2) - SPXclose*probnorm(-d1))-(best_ask+best_bid)/2;

error=abs(ee);

run;

however it does not work

the information in the log is following

NOTE: Your code contains 4 program statements.

NOTE: Gradient is computed using analytic formulas.

NOTE: Hessian is computed using analytic formulas.

ERROR: The variable SPXclose was referenced but not given a value.

ERROR: The variable strike_price was referenced but not given a value.

ERROR: The variable rate was referenced but not given a value.

ERROR: The variable TTM was referenced but not given a value.

ERROR: The variable best_ask was referenced but not given a value.

ERROR: The variable best_bid was referenced but not given a value.

WARNING: Your program statements contain 6 symbols used but not given a value.

WARNING: None of the data set variables are used in the program statements.

ERROR: There are references to missing variables when the program code is executed for _OBS_= 1

WARNING: Your program statements cannot be executed completely.

WARNING: In a total of 1 calls an error occurred during execution of the program statements.

NLP attempted to recover by using a shorter step size.

i can not understand where is the problem?

please help me, thanks for your help~

the code is like following

proc nlp data=AA outest=BB;

min error ;

PARMS sig=0.01;

d1=(log(SPXclose/(strike_price/1000))+(rate+((sig**2)/2))*TTM)/(sig*sqrt(TTM));

d2=d1-(sig*sqrt(TTM));

ee=((strike_price/1000)*exp((-rate)*TTM)*probnorm(-d2) - SPXclose*probnorm(-d1))-(best_ask+best_bid)/2;

error=abs(ee);

run;

however it does not work

the information in the log is following

NOTE: Your code contains 4 program statements.

NOTE: Gradient is computed using analytic formulas.

NOTE: Hessian is computed using analytic formulas.

ERROR: The variable SPXclose was referenced but not given a value.

ERROR: The variable strike_price was referenced but not given a value.

ERROR: The variable rate was referenced but not given a value.

ERROR: The variable TTM was referenced but not given a value.

ERROR: The variable best_ask was referenced but not given a value.

ERROR: The variable best_bid was referenced but not given a value.

WARNING: Your program statements contain 6 symbols used but not given a value.

WARNING: None of the data set variables are used in the program statements.

ERROR: There are references to missing variables when the program code is executed for _OBS_= 1

WARNING: Your program statements cannot be executed completely.

WARNING: In a total of 1 calls an error occurred during execution of the program statements.

NLP attempted to recover by using a shorter step size.

i can not understand where is the problem?

please help me, thanks for your help~

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-12-2011 09:08 AM

The most obvious problem: you are using several undefined variables, such as strike_price. Unless these are all variables in your data set, exactly as typed here, the program will not run. With SAS, sometimes one early error can then result in a long string of subsequent errors.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-12-2011 10:19 AM

i do not know how to input my data to proc nlp

could anyone support me a example, thanks~

could anyone support me a example, thanks~

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-12-2011 01:23 PM

You obviously have not learned how to use SAS yet. You actually specified the data file as AA, so I am guessing that this is just followed from an example. NLP is one of the most sophisticated procedures in SAS, requiring a knowledge of SAS and programming, as well as numerical optimization methods. You need to learn how to use sas data steps and procedures first.