Dear Sir or Madam,

for most of my problems I found a proper solution in an earlier posts. But since weeks I´m struggeling with calclutating a rolling geometric mean for daily stock returns. My data is as follows: Panel-Data. 2.200 Companies/Stocks (variable:permno). Date variable DDMMYYY (but with gaps, just trading days variable:date). Trading day - variable that counts from 1 to T - with no gaps (variable:trading_day), daily stock return (variable:ret). Now I want to calculate a rolling geometric mean over the next 22 days for each company . I`m really don`t know how to combine the codes to solve this problem. I tried the use runby but after a backcheck my outcome is always wrong. Hopefully tehre is someone out there who can help me solving this problem.

Thanks a lot in advance.

Best regards

Stefanie Leupold

for most of my problems I found a proper solution in an earlier posts. But since weeks I´m struggeling with calclutating a rolling geometric mean for daily stock returns. My data is as follows: Panel-Data. 2.200 Companies/Stocks (variable:permno). Date variable DDMMYYY (but with gaps, just trading days variable:date). Trading day - variable that counts from 1 to T - with no gaps (variable:trading_day), daily stock return (variable:ret). Now I want to calculate a rolling geometric mean over the next 22 days for each company . I`m really don`t know how to combine the codes to solve this problem. I tried the use runby but after a backcheck my outcome is always wrong. Hopefully tehre is someone out there who can help me solving this problem.

Thanks a lot in advance.

Best regards

Stefanie Leupold

## Comment