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

Re: st: How do you drop the variable -(e)- from the data?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   Re: st: How do you drop the variable -(e)- from the data?
Date   Wed, 5 Nov 2003 10:52:53 -0000

Roger Newson

> I am having a problem with the variable whose name is (e), which
appears to
> be generated whenever an estimation command is executed, and which
contains
> the results of the function -e(sample)-. This variable does not seem
to be
> well publicised anywhere accessible via -findit (e)-, but is listed
> whenever the user types
>
> list *
>
> or when the user types
>
> list *e*
>
> or even when the user types
>
> list ?e?
>
> Similarly, if the user types
>
> unab fifi:*
>
> or if the user types
>
> unab fifi:*e*
>
> or even if the user types
>
> unab fifi:?e?
>
> then the expanded varlist in the macro -fifi- includes the varname
(e).
>
> My problem is, how do you drop (e) from the data set without
dropping any
> other variables or estimation results? If I type
>
> ereturn clear
>
> then (e) ceases to exist, but so do the current estimation results.
If I type
>
> drop _all
>
> or if I type
>
> drop *e*
>
> or even if I type
>
> drop ?e?
>
> then Stata drops (e), and any other variables specified by the
abbreviated
> varlist provided by the user. However, if I type
>
> drop (e)
>
> then Stata replies
>
> variable e not found
> r(111):
>
> and refuses to drop (e). Is there a way of dropping (e) from the
data set
> in a Stata program without destroying anything else?

I don't have a solution to this. In fact I've never even
noticed (e) before. This raises the question of whether
it's been there for ages, or it's only recently become
visible as a result of some other change in Stata.

I can add that attempts to solve Roger's problem indirectly by
-keep-ing everything else also failed.

To follow Roger's speculation, it appears that (e) is just
e(sample) in another guise. It looks like a variable in many
ways, but it isn't a full-fledged variable; let's call it a
pseudovariable in ignorance of any unpublicised Stata Corp
terminology.

_n is another pseudovariable, one might say, although the
differences between it and (e) are just as crucial
as the differences. (For example, you can't drop _n
even indirectly; if you could, you would probably
break your Stata!)

What is a little more worrying is that there
seem to be small inconsistencies in how (e)
is treated.

. su

and

. su *

differ in whether (e) is included.

. d

and

. d *

don't, but

. ds

and

. ds *

do.... But then I have long assumed that

. su
. su *

. d
. d *

. ds
. ds *

. l
. l *

were all equivalent pairs, and typed the simpler
version every time.

I see two contradictory and equally plausible
stories here:

1 This is accidental, or even a mistake. Stata
Corp need to fix the code so that only their
outerwear is showing.

2 This is a subtle feature. Stata Corp have
introduced a nuanced distinction between
(every variable) and (every variable PLUS (e))
so that you can examine (e) whenever you wish,
so long as it exists.

Nick
[email protected]

P.S. at least one reason why you can't
look at (e) directly with e.g.

. l (e)

is that another rule, that varlists may
be parenthesised, leads to the parens being
ignored.

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