Hi all,
I have a dataset looks like this and I would like to calculate the cumulative stock return for the last 12 months. I found some answers but they did not solve my problems completely. Any suggestions are truly appreciated!!
permno date ret
10000 31dec1985
10000 31jan1986
10000 28feb1986 -.257142872
10000 31mar1986 .365384609
10000 30apr1986 -.098591551
10000 30may1986 -.22265625
10000 30jun1986 -.005025126
10000 31jul1986 -.080808081
10000 29aug1986 -.615384638
10000 30sep1986 -.057142857
10000 31oct1986 -.24242425
10000 28nov1986 .059999999
10000 31dec1986 -.377358496
10000 30jan1987 -.212121218
10000 27feb1987 0
10000 31mar1987 -.384615391
10000 30apr1987 -.0625
10000 29may1987 -.06666667
10000 30jun1987
10001 31dec1985
10001 31jan1986
10001 28feb1986 .020408163
10001 31mar1986 .025200004
10001 30apr1986 .00990099
10001 30may1986 -.009803922
My tasks have two-fold:
1. Compute cumulative return for the last 12 months defined as = (1+ return of month 1) * ((1+ return of month 2)*….*(1+return of month12) -1
The first variable is the permno (the security identifier), the ret is the monthly stock return. I would like to calculate the cumulative stock return for the past 12 months for each security. For example, for permno "10000", at date "30apr 1987", I would like to have the cumulative return starts from "30may 1986" (month 1) to "30apr 1987" (month 12). Likewise, for permno "10000", at date "29may1987", the cumulative return is compounded from "30jun 1986" (month 1) to "29may 1987" (month 12).
2. As you can see, there are some missing values for monthly stock return. I don't know if the monthly stock return is missing, how should I handle it. Can you give me some advice?
I know there are some posts about calculating the cumulative return but none of them compute the cumulative return for the past 12 months.
Thanks a lot for your time and help!!
Best,
Fiona
I have a dataset looks like this and I would like to calculate the cumulative stock return for the last 12 months. I found some answers but they did not solve my problems completely. Any suggestions are truly appreciated!!
permno date ret
10000 31dec1985
10000 31jan1986
10000 28feb1986 -.257142872
10000 31mar1986 .365384609
10000 30apr1986 -.098591551
10000 30may1986 -.22265625
10000 30jun1986 -.005025126
10000 31jul1986 -.080808081
10000 29aug1986 -.615384638
10000 30sep1986 -.057142857
10000 31oct1986 -.24242425
10000 28nov1986 .059999999
10000 31dec1986 -.377358496
10000 30jan1987 -.212121218
10000 27feb1987 0
10000 31mar1987 -.384615391
10000 30apr1987 -.0625
10000 29may1987 -.06666667
10000 30jun1987
10001 31dec1985
10001 31jan1986
10001 28feb1986 .020408163
10001 31mar1986 .025200004
10001 30apr1986 .00990099
10001 30may1986 -.009803922
My tasks have two-fold:
1. Compute cumulative return for the last 12 months defined as = (1+ return of month 1) * ((1+ return of month 2)*….*(1+return of month12) -1
The first variable is the permno (the security identifier), the ret is the monthly stock return. I would like to calculate the cumulative stock return for the past 12 months for each security. For example, for permno "10000", at date "30apr 1987", I would like to have the cumulative return starts from "30may 1986" (month 1) to "30apr 1987" (month 12). Likewise, for permno "10000", at date "29may1987", the cumulative return is compounded from "30jun 1986" (month 1) to "29may 1987" (month 12).
2. As you can see, there are some missing values for monthly stock return. I don't know if the monthly stock return is missing, how should I handle it. Can you give me some advice?
I know there are some posts about calculating the cumulative return but none of them compute the cumulative return for the past 12 months.
Thanks a lot for your time and help!!
Best,
Fiona
Comment