Statalist


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

Re: st: showing row labels in -table-


From   Martin Weiss <martin.weiss@uni-tuebingen.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: showing row labels in -table-
Date   Sun, 31 Aug 2008 22:44:48 +0200

Michael,

that is a lot clearer now. I can see your point. One technique that Stata employs for these purposes is a "key" in the upper left corner as in


tabulate rep78 foreign, clrchi2 row

Another one is

tabstat price mpg, statistics( mean count ) columns(variables)

where there are row headers. Note, though, that they disappear when you use -by- as in


tabstat price mpg, statistics( mean count p1 p50 ) by(foreign) columns(variables)



You may want to try your luck with -h tabdisp- which, AFAIK, most of these commands call to construct their output.

HTH
Martin



I do not think this is possible with -table-, you will probably have to try

Quoting Michael McCulloch <mm@pinest.org>:


Thank you Martin, I apologize. Here's my question, more clearly stated:

Is it possible to show the row headers for cell contents in summary
tables created with the -table- command? For example, in the following
table, stratified horizontally by:
	domestic
	foreign,
I have specified that the cell contents should report:
	mean mpg
	mean headroom.

What I would like to do is display the row headers "Avg mpg" and "Avg
headroom", underneath each of the row super headers Domestic and
Foreign.

clear
sysuse auto
tab price
gen pricelevel=1
replace pricelevel=2 if price>6000
table foreign pricelevel, contents(mean mpg mean headroom) col
format(%9.2g) cen

Therefore, I would like to specify that in this table the left-hand row
headers would read:
Domestic
	Avg mpg
	Avg headroom
Foreign
	Avg mpg
	Avg headroom

Hope this is more clear!




Although you demonstrate your problem with the -auto- dataset, I still do not get what you want. -pricelevel- has no -value labels-; on top of that, it forms the columns and not the rows. When I run your example, I get the following:


-------------------------------
| pricelevel
Car type | 1 2 Total
----------+--------------------
Domestic | 21 16 20
| 3.1 3.4 3.2
|
Foreign | 27 21 25
| 2.7 2.5 2.6


Maybe you can tell the list what more you want...

HTH
Martin

Quoting Michael McCulloch <mm@pinest.org>:


I'm using -table- to create summary tables. Is it possible to show the
row headers for cell contents?

For example, in this table I can't display pricelevel row labels for
the cell contents rows:

clear
sysuse auto
tab price
gen pricelevel=1
replace pricelevel=2 if price>6000
table foreign pricelevel, contents(mean mpg mean headroom) col
format(%9.2g) cen

Michael

*
*   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/



*
*   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/
*
*   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/



*
*   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/



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