[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: RE: Dichotomizing a Variable
This will give you the wrong answer
if there are any missings, and is
tricky to extend to problems with -if-
or -in-. Then there is the issue of -by-.
An alternative is to link this
to existing functions.
FAQ . . . . . . . . . . Calculating percentile ranks or plotting positions
7/02 How can I calculate percentile ranks?
How can I calculate plotting positions?
will lead you to a more general strategy.
> sort abc
> gen abcnew = _n > _N/2
> Suppose I have a variable, abc that consists of: 1 2 3 4 5 5
> 6 7 8 9. I want
> to dichotomize the variable at the median.
> generate abcnew = 0
> replace abcnew = 1 if abc > 5
> What statement do I write that assigns one of the 5s a 0 and
> the other 5 a 1
> in abcnew?
* For searches and help try: