Statalist


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

RE: st: showing row labels in -table-


From   Michael McCulloch <[email protected]>
To   [email protected]
Subject   RE: st: showing row labels in -table-
Date   Mon, 1 Sep 2008 05:10:09 -0700

I think you're right; ultimately much less work!

All of which makes me wonder: Would it be possible for you to export the
table and then edit it in a text editor?

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Michael McCulloch
Sent: Sunday, August 31, 2008 11:31 PM
To: [email protected]
Subject: Re: st: showing row labels in -table-

I appreciate your help, Martin. Unfortunately, I don't have the
skills to re-program ado commands such as -table-.

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 <[email protected]>:

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 <[email protected]>:


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/

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