Calculate idiosyncratic stock return volatility

I have noted two slightly different definitions of idiosyncratic stock return volatility in:

  • Campbell, J. Y. and Taksler, G. B. (2003), Equity Volatility and Corporate Bond Yields. The Journal of Finance, 58: 2321–2350. doi:10.1046/j.1540-6261.2003.00607.x
  • Rajgopal, S. and Venkatachalam, M. (2011), Financial reporting quality and idiosyncratic return volatility. Journal of Accounting and Economics, 51: 1–20.

The code in this post is used to calculate Campbell and Taksler’s (2003) idiosyncratic stock return volatility, but it can be easily modified for other definitions.

Specifically, this code requires an input dataset that includes two variables: permno and enddt, where enddt is the date of interest. This code will calculate the standard deviation of daily abnormal returns over the 180 calendar days before (and including) enddt. Abnormal returns will be calculated using four methods: (1) market-adjusted; (2) standard market model; (3) Fama-French three factors; and (4) Fama-French three factors as well as momentum. This code requires at least 21 return observations (one-month trading days) over that 180-day period for a permno to calculate its stock return volatility.


This entry was posted in SAS. Bookmark the permalink.

4 Responses to Calculate idiosyncratic stock return volatility

  1. Sultan Aziz says:

    Thank you very much for the idiosyncratic stock return volatility SAS code. It will help me so much in my research.

    I’ve quick questions:
    1- What is (a) dataset in the code?
    2- Does the code calculate the daily or monthly idiosyncratic?

  2. Joe says:

    Hi Kai,

    Thanks for sharing the code.
    I just find that in Campbell and Taksler (2003) “Equity Volatility and Corporate Bond Yields”, they didn’t calculate idiocyncratic volatility as you did. (Although your code is good).

    The following is a quote from their paper (Page 2330) “To summarize firm-level risk and return, we compute the mean and standard deviation of daily excess returns, relative to the CRSP value-weighted index, for each firm’s equity over the 180 days preceding (not including) the bond transac­ tion date. Thus, we avoid estimating betas for individual firms on the market in­ dex, effectively imposing a beta of one (and an alpha of zero) in the market model. Campbell, Lo, and MacKinlay (1997, p. 156) call this a “market-adjusted-return” model. We also include the mean and standard deviation of daily market returns, where the market is defined as the CRSP value-weighted index over the same 180 days. We expect the standard deviation of daily excess returns to have a positive effect on yield spreads

  3. Nieves says:


    Thanks for sharing the IVOL code! Much appreciated. By the way, can we use the std1/std2/std3 directly as IVOL? Is it the same as vol1/vol2/vol3 ?


Leave a Reply

Your email address will not be published. Required fields are marked *