I am trying to find the moving median for profit. ticker (date): egen medprofit=median(profit) won't do as this computes the median of all the observations within the group. mvsumm profit, force end stat(med) window(30) generate(medprofit) is also a no-go as it requires no gaps for the time variable and I do not wish to fill the gaps using tsfill. I would like to find the median profit for (1) the non-missing values of the last 30 observations (containing both missing and non-missing values) within ticker (date) and for (2) the non-missing values of the last 30 observations (containing only non-missing values) within ticker (date)
-
Login or Register
- Log in with
Comment