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

RE: st: -stylerules- updated on SSC


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: -stylerules- updated on SSC
Date   Thu, 14 Apr 2005 12:51:29 +0100

That said, what Roger is referring to in his
second comment is fairly rare in my experience. 

More generally, not changing the data is 
easier than you imply. You just don't do it, 
unless that is the purpose of the program. 

Nick 
[email protected] 

Roger Newson
 
> Re Point 1, file input and output is usually MUCH more 
> time-consuming than 
> in-memory operations such as checking `touse'. However, re 
> Point 2, Richard 
> is right, and a block of code which modifies the data 
> *permanently* should 
> indeed start with a single -preserve- and end with a single 
> -restore, not-, 
> just in case the user presses -break-.

Richard Williams 

> 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 
> un.  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