Statalist


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

st: RE: -replace- should not be use with temporary files (was: Comparing datasets)


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: -replace- should not be use with temporary files (was: Comparing datasets)
Date   Thu, 18 Sep 2008 17:22:38 +0100

This came up on the list a while back. 

Suppose you mistype the local macro reference. Say you mean to type 

save `myfile', replace 

but you have a minute brainstorm and you type `myfil'. Further suppose
that local macro `myfil' is not defined. Then Stata sees 

save, replace

which to Stata is perfectly legal and intelligible. Stata will overwrite
the original data file, which is not what you intended at all. Of
course, typos here and there can have all sorts of consequences, all of
which are strictly your fault, but this one could be catastrophic if
what you had in memory was only a small part of the data or nothing to
do with the dataset you last read in. 

There may be other reasons for not doing this, but that's one. 

Nick 
n.j.cox@durham.ac.uk 

Joseph Coveney

Steven Samuels wrote (excerpted):

. . . Technical support told me that "replace" should not be used when
saving temporary files.

------------------------------------------------------------------------
--------

This is news to me.  I use -replace- all of the time with temporary
files.
What did StataCorp technical support say was the matter with using
-save . . . , replace- with temporary files?


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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