Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Dichotomizing a Variable


From   "Reg Jordan" <drreg@earthlink.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Dichotomizing a Variable
Date   Fri, 7 Apr 2006 10:31:10 -0400

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?

Thanks for the assistance.

reg

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index