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

st: how to use data editor with do-files in STATA11

From   Amado David Quezada Sanchez <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: how to use data editor with do-files in STATA11
Date   Tue, 26 Jan 2010 10:58:07 -0600

I'm used to run big do-files for cleaning data. In several parts of my code I write "edit if..." so I can make specific corrections on the go. That would not be a problem in earlier versions of STATA (like STATA 9 or 10) because the execution of do-files stops until you're done with the first data edition window and then continues running the code until you reach the next data edition window. 
In STATA 11 the executed do-file doesn't stop. I suspect that's because in earlier versions of STATA all modifications are done until you confirm to accept changes or close the window, so the preserve command is executed first in case you would like to reverse all corrections. That helps a lot because you can, as I said, make corrections in interactive manner as the do-file runs.
A very simple example:
sysuse auto, clear
gen mpg_class=1 if mpg<20
replace mpg_class=2 if mpg>=20 & mpg<30
replace mpg_class=3 if mpg>=30
/* Let's say I would make modifications for three   */
/* specific situations, in extense do-files I would */
/* have many operations between the following lines */
edit if mpg_class==3 & foreign==1
edit if mpg_class==1 & foreign==0
edit if length>180 & mpg_class==2
/* If you run the whole code with STATA 11 you don't */
/* have the chance to make modifications or */
/* corrections on the go, you only get the last data */
/* editon window */
I'm very interested to make STATA 11 stop at each data edition window when you run the whole code. Any suggestion would be greatly welcome.
Thank you, 

Amado Quezada
National Institute of Public Health
Cuernavaca, Mexico

*   For searches and help try:

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