- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi guys.
I am having a problem with calculating rolling window cumulative returns.
I have a panel data set with daily returns of approximately 40 different companies and 8 years of data. None of the companies have the same inception date.
I would like to create a variable that shows the moving cumulative returns for the past 36 month for each company. If the company has not been in the sample for 36 months it should just be the cumulative return for total period the company has been the data set. Once it reaches 36 month of data, it should start calculating a rolling 36 month (750 business day) cumulative return.
I have no problem calulating a variable with a return series since inception. But I have trouble, when the base date has to move one day forward in time.
My data looks like this:
Data=Rolling:
date firm retun (daily)
1/1/2010 a 4%
1/2/2010 a 3%
.
.
1/1/2010 b 1%
1/2/2010 b -2%
.
.
04/24/2015 c 3%
04/25/2015 c -5%
Do you guys have any suggestions how to creating a variable with a rolling compounded cumulative return series with a window size of 36 month (approximately 750 week days of observations)? I would have to do a graph, when the variable has been created, but that shold not be a problem.
I really hope you can help,
best, Joe.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
PROC EXPAND let's you calculate a rolling N month cumulative product. That sounds exactly like what you want.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I would have loved that to work, but it is not a moving average, but a moving compoundig of the return that I am looking for :/...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
PROC EXPAND let's you calculate a rolling N month cumulative product. That sounds exactly like what you want.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Proc expand using 'movprod [Window]' did the job! Thanks 🙂