Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: replacement task


From   "Dimitriy V. Masterov" <[email protected]>
To   [email protected]
Subject   st: replacement task
Date   Wed, 21 Jan 2004 15:54:19 -0600 (CST)

I could not find a command that performs this simple task. I was hoping if
someone might have some advice. I have a variable named emp that looks
like this

emp	Freq.
0	93,404
1	55,537
2	36,556

I want to replace emp=2 at random with 0 or 1 depending on the relative
number of 1s and 0s in the sample. My outcome should look like this

emp     Freq.
0	116,329
1	69,168

Thank you in advance for your help.

Dimitriy Masterov

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index