I too stand corrected. I hadn't realised until
now that
1.
preserve
...
restore
is not exactly equivalent to
2.
tempfile whatever
save `whatever'
...
use `whatever', clear
as with 1. e(class) stuff seems to return, while
in 2. it doesn't. When I said "save" I meant
-save-; but in any case I checked the wrong
thing and read [P] preserve without checking
the behaviour of -preserve- and -restore-.
Is this documented anywhere?
Thanks for the correction.
Nick
[email protected]
Zurab Sajaia
> Actually that's not quite right either, only the e(sample)
> function was lost
> after -restore-, rest of the parameters stored by the program
> remained in
> memory.
>
> Anyways, in that particular case I could move -restore- up
> before using
> -ereturn- so everything is fine.
>
>
> >From: "Nick Cox" <[email protected]>
> >Reply-To: [email protected]
> >To: <[email protected]>
> >Subject: RE: st: problems with e(sample)
> >Date: Sun, 18 Jun 2006 15:41:03 +0100
> >
> >This isn't quite the explanation. You can't save
> >eclass results with a dataset in any case, so
> >whether they were or were not present previously
> >is secondary, indeed immaterial.
> >
> >The key fact remains that a -restore- loses the
> >information currently in memory. This is not
> >just the dataset currently in memory, but also
> >any eclass and rclass stuff in particular. (And
> >also ..., but let's focus on the main point.)
> >
> >In essence Zurab got what was asked for, however
> >much of a surprise that was.
> >
> >I guess the logic is that eclass and rclass stuff
> >is not intrinsically part of the dataset. Also,
> >in principle it can be re-produced at whim.
> >
> >The warning about -discard- is also puzzling here.
> >The implication that it is a dangerous command
> >is correct, but only if you don't read the help
> >and consider whether it is what you want.
> >
> >Nick
> >[email protected]
> >
> >Ada Ma
> >
> > > If you -preserve- before you do the regression, then your
> e(sample)
> > > won't be preserved as it wasn't there, so when you hit
> -restore- the
> > > ereturn values got zapped.
> > >
> > > You may want to watch out for -discard- too. I had
> similar problems
> > > looking for the ereturn values, not knowing that I had
> wiped the slate
> > > clean as I try desperately to save some memory space for
> running more
> > > regressions.
> >
> >Zurab Sajaia
> >
> > > > I found the cause of problem, -restore- works after setting
> > > all the ereturns
> > > > and it clears e(sample) leaving other parameters unchanged.
> > > >
> > > > "esample(varname) specified with ereturn post or repost
> > > gives the name of
> > > > the 0/1 variable indicating the observations involved in
> > > the estimation.
> > > > The variable is removed from the data but is available
> for use as
> > > > e(sample);"
> > > >
> > > > This is what they say in the help so it's still unclear to
> > > me why e(sample)
> > > > disapeares after restoring original data...
*
* 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/