Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Immediate mhodds and dialog programming

From   David Doody <>
Subject   st: Immediate mhodds and dialog programming
Date   Mon, 9 Apr 2012 11:12:59 -0700

Hi statalisters,

I apologize if this can be found elsewhere, but I haven't been
successful in my searches.  A colleague has asked me to replicate the
behavior of her old DOS version of EpiInfo in Stata, with respect to
calculating stratified Mantel-Haenszel OR estimates from multiple 2x2
tables.  Basically, she wants to be able to enter the numbers from
multiple 2x2 tables and see the individual OR estimates and the crude
and stratified OR and CI.

I went ahead and wrote a program that is an "immediate" version of
mhodds.  It takes the 4 cell counts and creates observations with
those counts as weights.  The separate tables are separated by "/",
and then I run mhodds (I may change to cc) on the file that is created
by those added observations.  So,

mhoddsi 100 100 50 25 / 25 75 50 100

would be an example of a simple command for two tables.

I could ask her to just use this immediate command in Stata, and I may
end up doing so.  But I'd like to create a dialog box that would allow
her to see the 2x2 table as she's used to.  This may be elementary
dialog programming, but I haven't been able to figure it out.  I don't
know how to show a 2x2 table in the dialog box, allow her to click a
button that will start to build the above command, and then clear the
2x2 table to allow her to enter another one.  I could build the dialog
box so that it has 2 or 3 or 10 tables, but I'd like to be flexible
and also clean.  Is there a concept that I'm not understanding that
allows a dialog box to start building the command (using "put"
statements or something else) and then only when a different button is
pushed is the command finalized and submitted?

Also, if this functionality is already available via someone else's
efforts, I'm happy to just use that.  I appreciate any ideas or
assistance you can provide.  Thanks!!


P.S.  Using Stata 12 on Windows 7, though should probably make it
compatible with Stata 11, just in case.
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index