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

Re: st: the xi: command


From   Mark Schaffer <M.E.Schaffer@hw.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: the xi: command
Date   Thu, 04 Jul 2002 12:06:39 +0100 (BST)

Quoting Ulrich Kohler <ukohler@sowi.uni-mannheim.de>:

> > I am using the xi: command to construct dummy variables from
> categorical
> > variables. My problem is that I would like the xi-command to
> not remove one
> > of the dummies but I cannot in the manual find a command
> that turns this
> > characteric off. Is it possible to keep all the dummy
> variables, or have I
> > for the first time in my life found a limitation in a Stata
> command?
> 
> If you consider this as a limitation, the answer is yes, I
> think so. But if 
> you only dealing with dummies you can use the gen()-option of
> the -tabulate- 
> command instead. For example the command
> 
> .. tab v1, gen(v1d)
> 
> produces dummies v1d1, v1d2, ... v1dk for the categorical
> variable v1. This 
> is faster than -xi- and allows more control over variable
> names. 
> 
> .. quietly tab v1, gen(v1d)
> 
> supresses the output, if you don't want to see it.  With
> 
> foreach var of varlist v1-v100 {
>      quietly tab `var', gen(`var'd)
> }
> 
> you produce dummies for variable lists.
> 
> 
> regards
> uli
> 

I just want to add that I've run into this problem too, and I too 
consider it a (rare) limitation.  More than once I've wanted to run a 
regression with explicit dummies for each category in combination 
with the -nocons- option, and without an ugly hack not worth 
repeating here (Uli's suggestion is *much* nicer) it isn't possible 
with -xi-'s dummies.

Cheers,
Mark

Prof. Mark Schaffer
Director, CERT
Department of Economics, School of Management
Heriot-Watt University, Edinburgh EH14 4AS
tel +44-131-451-3494 / fax +44-131-451-3008
email: m.e.schaffer@hw.ac.uk
web: http://www.som.hw.ac.uk/ecomes
________________________________________________________________

DISCLAIMER:

This e-mail and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to
whom it is addressed.  If you are not the intended recipient
you are prohibited from using any of the information contained
in this e-mail.  In such a case, please destroy all copies in
your possession and notify the sender by reply e-mail.  Heriot
Watt University does not accept liability or responsibility
for changes made to this e-mail after it was sent, or for
viruses transmitted through this e-mail.  Opinions, comments,
conclusions and other information in this e-mail that do not
relate to the official business of Heriot Watt University are
not endorsed by it.
________________________________________________________________
*
*   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