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

st: RE: tabodds.ado


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: tabodds.ado
Date   Fri, 9 Apr 2004 18:08:50 +0100

In this particular case, you have I think 
discovered two bugs and corrected them. The variables
concerned are temporary variables whose names 
are contained in local macros, so there's a small 
question of terminology in describing what was done. 

In general, however, and especially to others reading 
this who may be very new to Stata, I'd counsel that changing 
Stata's ado files is not a good idea, even if you know _exactly_
what you are doing. I would _never_ do it myself. 
 
A safer strategy by far is to copy an official .ado file to a 
file with a new name and work with the modified file. So if I 
had made this discovery, I would have copied -tabodds- to 
say -tabodds2- and worked with the modified file -tabodds2-, 
assuming that a bug fix like this would be made officially
by StataCorp extremely rapidly, so that a new -tabodds- would 
be the one chosen by Stata, given of course that I -update- 
early and -update- often. 

This seem purist, not to say paranoid, but bitter experience shows that 
some users change things incorrectly; or change things
but with unforeseen consequences; or change things 
and then change their minds, sometimes
forgetting exactly what they did; and so on, and so forth. 
The total effect is all too likely to be very puzzling results 
some time later which take up far time diagnosing than could possibly
be saved by modifying Stata's source .ado files. 

Copy and change; that's my advice. Never change the source code. 

Nick 
n.j.cox@durham.ac.uk 

Falk, Jonathan
 
> I believe I have found (and corrected) a problem in 
> tabodds.ado.  I have a
> dataset in which one population has 37363 cases out of 176875 exposed.
> tabodds reported zero exposed and zero cases for this group.  
> Examination of
> the code revealed that local variables d and h are defined in 
> the code as
> int.  I modified the ado file to have these become long and 
> the code appears
> to run correctly.  I see no obvious reason that these 
> variables need to be
> integers beyond the fact that the programmer did not 
> anticipate such large
> samples.  Unless someone tells me I've done something wrong, 
> I will keep
> these changes... listed below.
> 
>                          CHANGE: qui gen int `h' = `binomial' 
> - `myd' TO qui
> gen long `h' = `binomial' - `myd' 
> 		 CHANGE: gen int `d' = `myd' * `W' if `touse'  
> TO gen long
> `d' = `myd' * `W' if `touse'

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index