Hello! I have a dataset with income and expense throughout several years (1992, 1994, ... 2016)
I want to generate deciles. I know xtile doesn't work with by(). I tried using egen but it doesnt support weights and my data has weights. I thought i'd use forvalues however it doesn't seem to work either.

My code is:

forvalues i=1992(2)2016 {
xtile decil=income [w=factor] if year==`i', nq(10)
}

The problem I find is that the code stops at 1992, that is that I have deciles for 1992 only.

Can someone help me please?