Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: making quantiles based on controls


From   "Delahanty, Ryan" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: making quantiles based on controls
Date   Thu, 14 Oct 2010 10:46:02 -0500

I spend way too much time turning things into tertiles, quartiles, etc. 

So say I have to split a continuous variable like bmi into quartiles based on CONTROL values, I have to do this:

(In this example affection status of 1 = case, 0 = control).

by affection, sort: summarize bmi, detail
(which tells me the splits, and then I use them like so)
generate bmiquart = 0
replace bmiquart=1        if             21<bmi<=23
replace bmiquart=2        if             23<bmi<=26
replace bmiquart=3        if             26<bmi

and then I generate the dummies for bmiquart as I do the regression with something like this:
xi, prefix(): logistic affecttion age income education i.bmiquart

But the above is kind of cumbersome when splitting data a billion different ways. I'd like to substitute the first five lines and instead use a command like this: 
xtile bmiquart = bmi, nquantiles(4)

The problem with this is that this will just split it based on bmi for cases and controls. Is there a simple command or switch that will allow the quantiles to be generated based on the distribution in controls rather than both?

Thanks,
Ryan

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index