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

st: RE: help margin- beginner�s ask (again!)


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: help margin- beginner�s ask (again!)
Date   Thu, 20 Nov 2003 16:02:11 -0000

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/



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