I need to split some contrast vision readings on a group of children into the worst quintile versus the rest.
I had been using this:
xtile f7bstcntrst = f7vs204c, nq(5)
bysort f7bstcntrst : sum f7vs204c if f7vs204c!=.
sum f7vs204c if f7bstcntrst!=. & f7bstcntrst!=1
sum f7vs204c if f7bstcntrst!=. & f7bstcntrst==1
replace f7bstcntrst=0 if f7bstcntrst!=1
replace f7bstcntrst=. if f7vs204c==.
tab f7bstcntrst
However the problem with this comes in the first line - xtile is splitting my data into the quintiles of the contrast sensitivity logarithmic value, not into the children with the worst reading [smallest values] versus the rest of the children, which is what I want. How do I tell stata to make the quintile based on the 1/5 worst children's readings, not the 1/5 of the range of values possibly obtained?
If my question doesn't make sense, here are some pictures explaining my output and explaining what the contrast sensitivity readings mean.


[From Normal values for the Pelli-Robson contrast sensitivity test Maija Ma¨ntyja¨rvi, MD, Tarja Laitinen, MD]
I had been using this:
xtile f7bstcntrst = f7vs204c, nq(5)
bysort f7bstcntrst : sum f7vs204c if f7vs204c!=.
sum f7vs204c if f7bstcntrst!=. & f7bstcntrst!=1
sum f7vs204c if f7bstcntrst!=. & f7bstcntrst==1
replace f7bstcntrst=0 if f7bstcntrst!=1
replace f7bstcntrst=. if f7vs204c==.
tab f7bstcntrst
However the problem with this comes in the first line - xtile is splitting my data into the quintiles of the contrast sensitivity logarithmic value, not into the children with the worst reading [smallest values] versus the rest of the children, which is what I want. How do I tell stata to make the quintile based on the 1/5 worst children's readings, not the 1/5 of the range of values possibly obtained?
If my question doesn't make sense, here are some pictures explaining my output and explaining what the contrast sensitivity readings mean.
[From Normal values for the Pelli-Robson contrast sensitivity test Maija Ma¨ntyja¨rvi, MD, Tarja Laitinen, MD]
Comment