Statalist


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

st: RE: table display


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: table display
Date   Wed, 18 Jul 2007 21:13:29 +0100

Consider this example: 

. sysuse auto 
. table rep78, c(mean mpg)

----------------------
Repair    |
Record    |
1978      |  mean(mpg)
----------+-----------
        1 |         21
        2 |     19.125
        3 |    19.4333
        4 |    21.6667
        5 |    27.3636
----------------------

. egen meanmpg = mean(mpg), by(rep78)

. egen axis = axis(meanmpg rep78), label(rep78)

. _crcslbl axis rep78 

. table axis, c(mean mpg)

----------------------
Repair    |
Record    |
1978      |  mean(mpg)
----------+-----------
        2 |     19.125
        3 |    19.4333
        1 |         21
        4 |    21.6667
        5 |    27.3636
----------------------

The -egen- function -axis()- is in -egenmore- on SSC. 
You should install -egenmore- using -ssc-.  

The dopey name -axis()- reflects the fact that it 
was written with graphics in mind. But the same problem 
arises with tables, as your post shows. 

Nick 
[email protected] 

A. Manzoni
 
> I am using the table command to display the mean value of var 
> y for different values of the variable z. 
> table z, c(mean y)
> How can I display it in a way such that values are ordered by 
> the values of the mean of y?

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