Hi,
I have panel data, permno is my panel variable. I want to create covariance between returns and lag_returns for each permno and store the values in a new column. I have data of 1 year for each panel variable. I don't want to get 1 covariance figure for each permno. Instead, for a given permno and date, I want to calculate covariance for the values till that specific date.
For example, if permno=10001 and date=date=19900111, my covariance figure should be cov (returns, lag_returns) for the period date=19900102-19900111


Thank you