10-24-2013 03:24 PM
I have a question regarding calculating a rolling average. Let's say that I have a dataset contains date, stock identifier, and daily volume turnover. For each stock and for each date, I want to calculate the average of daily volume turnover over the previous six months. For example, if the date says 2013-Oct-24, then I want to calculate the average of daily turnover from 2013-April-01 to 2013-Sep-30 using all available observations during this period (as trading days are fewer than calendar days, or the data may starts at 2013-August-01).
I have attached a sample dataset. permno is the stock identifier, and daily_turn is the daily volume turnover.
Thanks for the help.
10-24-2013 04:28 PM
I know that I could use proc expand to calculate moving averages with specified lookback period. But for my case where the lookback period is not specified, how does it work?