I'm currently producing some work on a win percentage rolling average for international football managers, as I aim to use this in some duration modelling in the future. I'm just a little unsure on how to produce this rolling average in Stata to take account of the dummies for win, draw or loss and when the manager leaves their job. I've also produced a 'result variable' merely as a category variable capturing these three outcomes.
E.g for the first 3 observations in my dataset I have the first manager who wins his first two games and loses his third; after this he then leaves his position. So numerically he would have 100% win percentage for the first and second observations followed by 66.6% for the third. Then the win percentage would have to reset for the new manager. I've coded managers' ids respectively if this helps. I'm just wondering how to code this rolling average properly as opposed to using a calculator each time?