<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic calculate implied volatillity by Black-Schole model and NLP in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/calculate-implied-volatillity-by-Black-Schole-model-and-NLP/m-p/65163#M18579</link>
    <description>i want to calculate implied volatility using proc NLP&lt;BR /&gt;
&lt;BR /&gt;
the code is like following&lt;BR /&gt;
&lt;BR /&gt;
proc nlp data=AA outest=BB;&lt;BR /&gt;
min error ;&lt;BR /&gt;
PARMS sig=0.01;&lt;BR /&gt;
d1=(log(SPXclose/(strike_price/1000))+(rate+((sig**2)/2))*TTM)/(sig*sqrt(TTM));&lt;BR /&gt;
d2=d1-(sig*sqrt(TTM));&lt;BR /&gt;
ee=((strike_price/1000)*exp((-rate)*TTM)*probnorm(-d2) - SPXclose*probnorm(-d1))-(best_ask+best_bid)/2;&lt;BR /&gt;
error=abs(ee);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
however it does not work &lt;BR /&gt;
&lt;BR /&gt;
the information in the log is following&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Your code contains 4 program statements.&lt;BR /&gt;
NOTE: Gradient is computed using analytic formulas.&lt;BR /&gt;
NOTE: Hessian is computed using analytic formulas.&lt;BR /&gt;
ERROR: The variable SPXclose was referenced but not given a value.&lt;BR /&gt;
ERROR: The variable strike_price was referenced but not given a value.&lt;BR /&gt;
ERROR: The variable rate was referenced but not given a value.&lt;BR /&gt;
ERROR: The variable TTM was referenced but not given a value.&lt;BR /&gt;
ERROR: The variable best_ask was referenced but not given a value.&lt;BR /&gt;
ERROR: The variable best_bid was referenced but not given a value.&lt;BR /&gt;
WARNING: Your program statements contain 6 symbols used but not given a value.&lt;BR /&gt;
WARNING: None of the data set variables are used in the program statements.&lt;BR /&gt;
ERROR: There are references to missing variables when the program code is executed for _OBS_= 1&lt;BR /&gt;
WARNING: Your program statements cannot be executed completely.&lt;BR /&gt;
WARNING: In a total of 1 calls an error occurred during execution of the program statements.&lt;BR /&gt;
NLP attempted to recover by using a shorter step size.&lt;BR /&gt;
&lt;BR /&gt;
i can not understand where is the problem?&lt;BR /&gt;
&lt;BR /&gt;
please help me, thanks for your help~</description>
    <pubDate>Thu, 12 May 2011 10:47:53 GMT</pubDate>
    <dc:creator>bqk</dc:creator>
    <dc:date>2011-05-12T10:47:53Z</dc:date>
    <item>
      <title>calculate implied volatillity by Black-Schole model and NLP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-implied-volatillity-by-Black-Schole-model-and-NLP/m-p/65163#M18579</link>
      <description>i want to calculate implied volatility using proc NLP&lt;BR /&gt;
&lt;BR /&gt;
the code is like following&lt;BR /&gt;
&lt;BR /&gt;
proc nlp data=AA outest=BB;&lt;BR /&gt;
min error ;&lt;BR /&gt;
PARMS sig=0.01;&lt;BR /&gt;
d1=(log(SPXclose/(strike_price/1000))+(rate+((sig**2)/2))*TTM)/(sig*sqrt(TTM));&lt;BR /&gt;
d2=d1-(sig*sqrt(TTM));&lt;BR /&gt;
ee=((strike_price/1000)*exp((-rate)*TTM)*probnorm(-d2) - SPXclose*probnorm(-d1))-(best_ask+best_bid)/2;&lt;BR /&gt;
error=abs(ee);&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
however it does not work &lt;BR /&gt;
&lt;BR /&gt;
the information in the log is following&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Your code contains 4 program statements.&lt;BR /&gt;
NOTE: Gradient is computed using analytic formulas.&lt;BR /&gt;
NOTE: Hessian is computed using analytic formulas.&lt;BR /&gt;
ERROR: The variable SPXclose was referenced but not given a value.&lt;BR /&gt;
ERROR: The variable strike_price was referenced but not given a value.&lt;BR /&gt;
ERROR: The variable rate was referenced but not given a value.&lt;BR /&gt;
ERROR: The variable TTM was referenced but not given a value.&lt;BR /&gt;
ERROR: The variable best_ask was referenced but not given a value.&lt;BR /&gt;
ERROR: The variable best_bid was referenced but not given a value.&lt;BR /&gt;
WARNING: Your program statements contain 6 symbols used but not given a value.&lt;BR /&gt;
WARNING: None of the data set variables are used in the program statements.&lt;BR /&gt;
ERROR: There are references to missing variables when the program code is executed for _OBS_= 1&lt;BR /&gt;
WARNING: Your program statements cannot be executed completely.&lt;BR /&gt;
WARNING: In a total of 1 calls an error occurred during execution of the program statements.&lt;BR /&gt;
NLP attempted to recover by using a shorter step size.&lt;BR /&gt;
&lt;BR /&gt;
i can not understand where is the problem?&lt;BR /&gt;
&lt;BR /&gt;
please help me, thanks for your help~</description>
      <pubDate>Thu, 12 May 2011 10:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-implied-volatillity-by-Black-Schole-model-and-NLP/m-p/65163#M18579</guid>
      <dc:creator>bqk</dc:creator>
      <dc:date>2011-05-12T10:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: calculate implied volatillity by Black-Schole model and NLP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-implied-volatillity-by-Black-Schole-model-and-NLP/m-p/65164#M18580</link>
      <description>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.</description>
      <pubDate>Thu, 12 May 2011 13:08:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-implied-volatillity-by-Black-Schole-model-and-NLP/m-p/65164#M18580</guid>
      <dc:creator>lvm</dc:creator>
      <dc:date>2011-05-12T13:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: calculate implied volatillity by Black-Schole model and NLP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-implied-volatillity-by-Black-Schole-model-and-NLP/m-p/65165#M18581</link>
      <description>i do not know how to input my data to proc nlp&lt;BR /&gt;
could anyone support me a example,  thanks~</description>
      <pubDate>Thu, 12 May 2011 14:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-implied-volatillity-by-Black-Schole-model-and-NLP/m-p/65165#M18581</guid>
      <dc:creator>bqk</dc:creator>
      <dc:date>2011-05-12T14:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: calculate implied volatillity by Black-Schole model and NLP</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-implied-volatillity-by-Black-Schole-model-and-NLP/m-p/65166#M18582</link>
      <description>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.</description>
      <pubDate>Thu, 12 May 2011 17:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-implied-volatillity-by-Black-Schole-model-and-NLP/m-p/65166#M18582</guid>
      <dc:creator>lvm</dc:creator>
      <dc:date>2011-05-12T17:23:31Z</dc:date>
    </item>
  </channel>
</rss>

