Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: -stylerules- updated on SSC


From   Richard Williams <[email protected]>
To   [email protected], <[email protected]>
Subject   Re: st: -stylerules- updated on SSC
Date   Wed, 13 Apr 2005 19:40:23 -0500

At 04:07 PM 4/13/2005 +0100, Nick Cox wrote:
The package -stylerules- on SSC has been
updated. I started by making a few changes
in the light of Stata 9, but mostly thought
of some other things to mention while
I was doing that.
Some very good rules there Nick. I'd be curious what thoughts people have about this one:

"Avoid preserve if possible. preserve is attractive to the programmer but can be expensive in time for the user with large data files. Programmers should learn to master marksample."

Suppose I ignore that advise and instead do something like

preserve
keep if `touse'

1. Will I gain some speed, because Stata will be working with a smaller data set and won't have to repeatedly process -if `touse'- commands?

2. Isn't there a potential tradeoff between this and another rule, respect the dataset? If you don't preserve, there is a greater burden on the programmer to make sure all is well at the end of the run. But, isn't there also a greater risk if, say, the user stops the program before completion?

I suppose good, careful programmers can guarantee both speed and security of data. But, I would add the caveat that, if you are not 100% confident of your programming, you might want to favor safety over speed.


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




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