Hi Cathal
If you impute using the long form in Stata, my first idea was to manually (i.e. without using the mi passive command) generate the quntiles using xtile in each imputed dataset, using something like:
bysort _mi_m: xtile newinc = income, n(5)
but this doesn't work because the xtile command cannot be used with bysort. A more long-winded solution would be to use a for loop, cycling through the imputations (I'm assuming there are 10 imputations):
gen newinc=.
forvalues i=1(1)10 {
xtile temp = income if _mi_m==`i', n(5)
replace newinc=temp if _mi_m==`i'
drop temp
}
But shortly after asking the question, Cathal emailed me which a much neater solution, to use the egen=cut() command, which can be used with mi passive:
mi passive: egen newinc = cut(hhinc), group(5)
More generally, the advantage of using mi passive rather than manually manipulating the variables (as I was trying to do), is that mi passive correctly takes the appropriate steps regardless of how you have mi set the data, whereas my attempts at solutions would only work with the data imputed in the long form.
Best wishes
Jonathan