Hi,
I'm trying to generate the standard deviation from monthly and daily stock returns. For generating the standard deviation from daily stock returns, I did the following :
egen SD = sd(return), by(id year). And it seem to be working. But, I just have trouble with generating the standard deviation from monthly stock returns over the previous 5 years. The issue is that I don't know how to do the grouping for the 5 previous years.
My monthly data seems like this
ID date returns
01 Jan1986 0.0021
01 Feb1986 0.0023
01 Mar1986 0.0013
01 .... ...
01
...
Thanks for your help.
Ps: I don't really know if what I did to generate the standard deviation from daily stock returns over the past year is correct !
I'm trying to generate the standard deviation from monthly and daily stock returns. For generating the standard deviation from daily stock returns, I did the following :
egen SD = sd(return), by(id year). And it seem to be working. But, I just have trouble with generating the standard deviation from monthly stock returns over the previous 5 years. The issue is that I don't know how to do the grouping for the 5 previous years.
My monthly data seems like this
ID date returns
01 Jan1986 0.0021
01 Feb1986 0.0023
01 Mar1986 0.0013
01 .... ...
01
...
Thanks for your help.
Ps: I don't really know if what I did to generate the standard deviation from daily stock returns over the past year is correct !
Comment