I have a panel dataset organised on the individual level and I am trying to impute a categorical variable which have missing values using a count variable (The dependent variable). I have made 5 imputations and now I would like to aggregate those five datasets by Time and the imputed categorical var as a state ID. I know that collapse can’t be used with mi in stata, is there any way that I can perform this manually using mi xeq or any alternatives? My aim at the end of this to use mi estimate with a glm family(Poisson) on the 5 imputations in there aggregative forms.