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

st: RE: RE: RE: dangerous preserve

From   "Nick Cox" <>
To   <>
Subject   st: RE: RE: RE: dangerous preserve
Date   Sun, 20 Apr 2008 17:33:56 +0100

Yes, but Stata also assumes that you are smart and capable of thinking
about what you are doing. 

If you say -clear- then Stata doesn't come back with "are you sure?"
even if you have been on-line for a very long time and that -clear-
might lose a massive amount of work. 

-preserve- is intended mostly for programmers, as the online help
indicates. It appears in many programs, and usually the -restore- is
automatic when the program terminates. 

As said before, I agree with you that -preserve- used interactively can
bite. And as said before, you can program your way around that by
writing a wrapper that protects you against the main problem. That being
so, I see no case for any change to -preserve-. 

Martin Weiss


fair enough, but it should be possible to advise just the way Stata
if the change flag for the dataset is 1. Fortunately, it gives a warning
to the changed nature of the data you are about to destroy and prevents
from doing stupid things. I remember reading a section in the handbooks
about how Stata is so very careful with commands that may change your
in undesirable ways. Should the same not happen for -preserve-d data?

Nick Cox

I think this is mostly on the level of yes, sharp knives can cut you if
you are not careful. 

As I understand it, 


does not rule out a subsequent -restore-. 

But otherwise yes, you can get bitten if you forget what you have done. 

It would be easy enough to write a command that -save-d while it
-preserve-d, but 
you would have to remember to use it. I can't see an advantage in
advising that 
over advising the use of -save- before -preserve- when that's a good
idea -- or indeed over recommending -save- and avoiding -preserve- if
you are going to forget what you have done. 

Martin Weiss

I was wondering if anyone apart from me has been bitten by -preserve-? I
recently preserved data, then dropped half my data to carry out some
calculations and later forgot the preserve-status and saved. Now call me
foolish, but in the heat of the action, it is easy to forget about the
status of your data, isn`t it?
So: is there a mechanism to alert me to this danger, and if not, should
there be one?

*   For searches and help try:

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