I'm trying to collapse a large dataset by year, gender, and economic sector but instead of the usual percentile groups I'm trying to use quintiles, or deciles.
I know that xtile is a popular command but it doesn't work with by or with bysort , and I'm splitting things by three dimensions. I outline an example using the unions dataset below.
Code:
webuse union , clear tab1 year union black age
I know how to make this work for a given percentile, so for the tenth percentile I could write this
Code:
collapse /// (p10) age (count) N=age, /// by(year union black)
Code:
collapse /// (p1-p10) age (count) N=age, /// by(year union black)
0 Response to Combining groups of percentiles in collapse
Post a Comment