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
A very similar question came up not too long ago. This weird looking
command will get you close to the above split but not quite (and you'll get
slightly different results than I show here):