# st: going from a 2x2 table to a listing with results from many of them

 From John Hansen To statalist@hsphsun2.harvard.edu Subject st: going from a 2x2 table to a listing with results from many of them Date Tue, 25 Aug 2009 07:57:56 -0700

```Hello!

I apologize if this is a duplicate post.  I sent originally just as I
became a list subscriber and I didn't receive any replies.  This in
itself doesn't necessarily indicate nobody saw my message.  There are
lots of reasons why I might not have received a reply.  I looked in
the conversation threads though and didn't see my post either so I
fear statalist may not have recognized me as a subscriber yet.

I'm trying to venture away from menu driven work into some
programming.  I know that there's probably a way to do what I want and
I'm hoping that someone can point me in the right direction.  I don't
necessarily need specifics... I'm hoping for at least a nudge!  (And I
have a couple of stata programming books en route to me as well!)

I'm comparing cumulative incidence data in two groups, say exposed and
unexposed for a set of outcomes (outcome1, outcome2, etc.).  So
consider that for each outcome I could make up a 2x2 table showing
combinations of exposed cases (a), unexposed cases (b), exposed
controls (c) and unexposed controls (d).  So I currently have my data
structured like this:

outcome1     a1     b1     c1     d1
outcome2     a2     b2     c2     d2
...
outcomen     an     bn     cn     dn

If I were just producing a 2x2 table for outcome1, I could easily
produce an OR, lower and upper CI, p-value, etc.  Same for every other
row in the set... I know there must be a simple concept that allows me
to get to something like this

OUTCOME      A      B      C      D    OR  CI:LL  CI:UL   Pvalue
outcome1     a1     b1     c1     d1   OR1 LL1    UL1     pvalue1
outcome2     a2     b2     c2     d2   OR2 LL2    UL2     pvalue2
...
outcomen     an     bn     cn     dn   ORn LLn    ULn     pvaluen

If I've got several hundred outcomes, is this best done looping
through the dataset and building a table of results?  Or is there an
easier way to do this?

I appreciate any pointers.  Thanks!

John Hansen

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```