[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: keep or delete the commands which need to revise when editing do files?

From   Svend Juul <SJ@SOCI.AU.DK>
To   <>
Subject   Re: st: keep or delete the commands which need to revise when editing do files?
Date   Fri, 28 Nov 2008 11:43:41 +0100

Mandy wrote:

I was wondering if anyone could give me some suggestion of how to
decide to keep or delete the commands which need to revise when
editing the do files.

For example, my project usually involves the following steps:
1. read  the original data into stata
2. clean the data and get the original complete data set
3. analyze data, create some new variables(such as dummy variables),
and create some data sets (such as data set 1 is only for full-time
year round workers, data set 2 is for part-time workers, data set 3 is
for those who don't work at all)
4. analyze data , like run regressions,etc.

sometimes when I have started step 4 for sometime, I find there's
something need to revise in step 3. For example, some people in data
set 3  whom I defined as not work at all should be in data set 2
"part-time workers". So, I need to correct it. At least there're two
ways to do this:

1) In step 3. above  I replace the incorrect commands with the correct
ones, and then re-run the commands to update the data sets created
2) I append some extra commands to the existent do files to revise.
That is, the initial incorrect commands remain in the do-files.

So do files for these two ways seem like as follows:
*do file

command after revise
.   . . . .*do file
initial commands(Which need to revise)
extra command to revise
Which way is better? How should I  decide this? This question is
important to me since it's helpful for me to  get good habit of
managing data sets and do files.


Kit Baum responded and pointed to "The Workflow of Data Analysis 
in Stata" by Scott Long - which he had not yet seen. Neither
have I, but I ordered it.

In the meantime: In "An Introduction to Stata for Health Researchers"
(Stata Press) I recommend some principles, habits, and tools for
safe, consistent, and documented data management. You find much of 
the same advice in Juul S: Take Good Care of Your Data, downloadable 

Good luck,


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

*   For searches and help try:

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