Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Cumulative Return Calculation for Recurring Periods
From
Edward Crawley <[email protected]>
To
[email protected]
Subject
st: Cumulative Return Calculation for Recurring Periods
Date
Wed, 19 Jun 2013 19:27:45 +0100
Dear listers,
I am trying to calculate cumulative returns for recurring periods in
my panel dataset;
date company return
2001m1 1 .
2001m2 1 .14425
2001m3 1 -.215709
2001m4 1 -.160343
2001m5 1 .390866
2001m6 1 -.014815
2001m1 2 .
2001m2 2 .315081
2001m3 2 -.392042
2001m4 2 -.127833
2001m5 2 .646627
2001m6 2 .133531
2001m1 3 .
2001m2 3 .184734
2001m3 3 -.036814
2001m4 3 -.29605
2001m5 3 .457318
2001m6 3 -.060292
.
.
.
.
For instance, for each firm, I need to calculate cumulative returns
for recurring 3 periods ( e.g. from 2001m1 to 2001m4 and from 2001m2
to 2001m5 and ... etc.).
I used the following code, but it didn't give the desired result;
bys company (date): g c=sum(ln(return+1))
replace c=exp(c)-1
rename c cumreturn
I appreciate any help,
Best regards,
Edward
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/