Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Grouped vars with different summary measures in one table


From   Gawrich Stefan <s.gawrich@hlpug.hessen.de>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: Grouped vars with different summary measures in one table
Date   Mon, 17 Dec 2007 10:44:44 +0100

Hi Statalisters,

I often have to report different summary measures of different vars by
group-level in one table. For example I'd like to display the proportion of
overweight pre-school children (mean of dummy-var var1), the number of cases
(sum of counting-var var2) and the median score of a test (p50 of var3) by
city: 

    city     | overweight  cases  score  
  Frankfurt  |   0.12        77    53   
  Wiesbaden  |   0.11       112    68    
...

tabstat (one-by-one or with all vars and summary measures specified
simultaniously) give the results but one needs a lot of copy & paste to a
spreadsheet to get it in shape. collapse is of course another solution but
slow with big datasets and certainly a very big transformation just to
obtain some descriptive statistics.

If there's a solution already available I would be glad to know. I'm
thinking of a command where (as in collapse) summary measures can
individually be assigned to vars, like:  tabstat2 (mean) var1 (sum) var2
(p50) var3, by(group). 

Best wishes

Dr Stefan Gawrich
Hesse Health State Office
Dillenburg 
Germany
*
*   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–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index