Statalist The Stata Listserver


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

st: Re: tabstat: values in columns instead of rows?


From   "Hendro Hendratno" <[email protected]>
To   <[email protected]>
Subject   st: Re: tabstat: values in columns instead of rows?
Date   Fri, 28 Apr 2006 11:26:36 +0700

Jan,

This is my ado file that used to create multiple variables in the row of table. It's simillar with collapse command but the result with appear in the screen rather than change the data.

Bests,

Hendro

----- Original Message ----- From: "Sauermann, Jan" <[email protected]>
To: <[email protected]>
Sent: Wednesday, April 12, 2006 4:56 PM
Subject: st: tabstat: values in columns instead of rows?



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/


Attachment: tabcollps.hlp
Description: Binary data

Attachment: tabcollps.ado
Description: Binary data




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index