I'm not clear what is unclear here.
But coding depends on how your variable is coded
at present. Suppose you are currently
coding -myvar- with values with 1 and 2.
. gen dummy = myvar - 1
will convert it to 0/1 form.
Suppose you are coding -sex- with string
values "male" and "female".
. gen gender = sex == "female"
will map "female" to 1 and "male" to 0
(and also any missings etc. to 0), so that
. gen gender = 1 if sex == "female"
. replace gender = 0 if sex == "male"
may be safer. Follow by
. count if missing(gender)
This may help on binaries (true and false, etc.):
http://www.stata.com/support/faqs/data/trueorfalse.html
Nick
[email protected]
Nick Varian
> In the help file of margin, the author says to code the
> dummy variable as 0/1. How can I do that?
*
* 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/