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

Re: st: dangerous preserve

From   Svend Juul <SJ@SOCI.AU.DK>
To   <>
Subject   Re: st: dangerous preserve
Date   Sun, 20 Apr 2008 19:21:08 +0200

Martin Weiss wrote:
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?
Martin Weiss
The most dangerous thing you did was probably not to use -preserve- and 
forget that, but to save your data using the SAME filename as before.
Here are a few, very simple, very logical, and very safe rules to follow:
1. Modifications intended to be permanent should be made in a do-file,
never interactively.
2. This do-file should start with a command reading data (typically
-use-) and end with a -save- command, saving the modified data with
a NEW name.
3. Give this do-file a name that tells what it does. My suggestion:
use a gen_ prefix: is the to-file that generates the
new alpha7.dta dataset.
4. Don't mix data management activities and analysis commands in the 
same do-file.
You can find a more elaborate version of this advice in S. Juul: An
Introduction to Stata for Health Researchers. Stata Press 2006.
Take care!

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6 
DK-8000 Aarhus C,  Denmark 
Phone, work:   +45 8942 6090 
Phone, home:   +45 8693 7796 
Fax:           +45 8613 1580 

*   For searches and help try:

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