[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: tabodds.ado
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.
> 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: