Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: RE: xi command deletes variables without warning


From   "Thuy Le" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: xi command deletes variables without warning
Date   Sat, 25 Feb 2006 01:13:15 -0500

Thank Nick and David for the clarifications. I didn't find those in the help
file. 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of David Harrison
Sent: Friday, February 24, 2006 4:21 AM
To: [email protected]
Subject: st: RE: RE: xi command deletes variables without warning

Two more approaches to this that Nick hasn't mentioned...

1. Use the -prefix()- option to specify a different prefix each time you use
-xi-. When -xi- is run it deletes any existing variables with the same
prefix (usually "_I") that have previously been created by -xi-.
For example:

xi, noomit prefix(_I) i.region i.income
xi, noomit prefix(_J) i.interval

2. Clear the dataset characteristics where Stata stores the information on
variables created by -xi-. For example:

xi, noomit i.region i.income
char _dta[__xi__Vars__Prefix__]
char _dta[__xi__Vars__To__Drop__]
xi, noomit i.interval

Hope this helps

David

BTW (note for Stata tech people), there seems to be a bug in the
-noomit- option... If -xi- is used with -noomit- it defaults to having no
prefix rather than the usual "_I" and the dataset characteristics are set
wrong, e.g.

. sysuse auto
(1978 Automobile Data)

. xi, noomit i.rep78

. char li
_dta[__xi__Vars__To__Drop__]:
                            rep78_1 rep78_2 rep78_4 rep78_5

(rep78_3 has been created but is not listed as a variable to drop)

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 24 February 2006 08:44
To: [email protected]
Subject: st: RE: xi command deletes variables without warning

Everyone! 

In 18th century landscape architecture in Britain, designers used features
called "ha-has" in country estates. 
These were little grassy trenches into which walkers dropped without
warning. As some wit pointed out at the time, the "ha-ha" surprise or shock
was never the same the second time round. 

-xi:- does do exactly what you report. It is a deliberate, designed feature.
The argument is that 

(a) It is all too easy otherwise to accumulate lots and lots and lots of
dummy variables from even a few analyses. In a strong sense, such variables
contain no new information, as they can be derived immediately from the
original variables. For most purposes, such variables just bloat datasets
unnecessarily. 

(b) It is very easy to generate them all over again with a subsequent -xi:-.


(c) If you do want to keep those dummies, it is easy to generate them
otherwise or to -rename- those you want. 

Nick
[email protected] 

Thuy Le
 
> I have a panel data set with about 20 variables and less than 700 
> observations. I used the following command in STATA9 SE
> 
> .xi, noomit i.region i.income
> 
> to generate the dummies and it work fine. I saved the file and when I 
> used the command again with the same command for another variable
> 
> .xi, noomit i.interval
> 
> STATA somehow deleted some of the previously generated dummies. 
> 
> I used another command with no problem
> 
> .qui tab, gen(interval_)
> 
> Is there anyone experienced the same problem?

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

*
*   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/


*
*   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