Statalist The Stata Listserver


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

st: tabstat: values in columns instead of rows?


From   "Sauermann, Jan" <[email protected]>
To   <[email protected]>
Subject   st: tabstat: values in columns instead of rows?
Date   Wed, 12 Apr 2006 11:56:34 +0200

Dear Statalist-Users,

I want to create a cross-table in the following form:
 
        | VAR1 == 0                  | VAR1 == 1                  | Total
--------+----------------------------+----------------------------|-------------
X_1     | mean of X_1 (if VAR1 == 0) | mean of X_1 (if VAR1 == 1) | mean of X_1
X_2     | mean of X_2                | mean of X_2                | mean of X_2
  .     |    .                       |    .                       |   .
  .     |    .                       |    .                       |   .
  .     |    .                       |    .                       |   .
  .     |    .                       |    .                       |   .
  .     |    .                       |    .                       |   .
X_N     | mean of X_N                | mean of X_N                | mean of X_N
------------------------------------------------------------------|-------------

where all variables (VAR1, X_1 ... X_N) are binary. A similar result could be achieved by 

	tabstat X_1 X_2 ... X_N, by(VAR1)

with the result:

Summary statistics: mean
  by categories of: VAR1 

    VAR1 |     X_1     X_2       X_3        X_4
---------+----------------------------------------
       0 |  .1119746  .8359621  .2555634  .5063582
       1 |  .0486352  .6175836  .1630881  .5350927
---------+----------------------------------------
   Total |  .0530139  .6494703   .169481  .5331062
--------------------------------------------------


However, we would like to have this table with columns "VAR1 == 0" and "VAR1 == 1", analogue to the example above. 


Kind regards, Jan




--

---------------------------------------
Jan Sauermann

Halle Institute for Economic Research (IWH)

Kleine Maerkerstrasse 8 | phone: +49 345 7753-855 
D - 06108 Halle (Saale) | fax:   +49 345 7753-799
http://www.iwh-halle.de | mail:  [email protected]


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