Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Manipulating tabulation output so rows are sorted by value of column...


From   Rieza Soelaeman <[email protected]>
To   [email protected]
Subject   st: Manipulating tabulation output so rows are sorted by value of column...
Date   Thu, 9 Feb 2012 17:27:06 -0600

Dear all,

Supposing I have the following data:
Name   Year    Value
AA    1990 985
AA    1990 246
AA    2000 237
AA    2000 560
BB    1990 457
BB    1990 742
BB    2000 985
BB    2000 154
CC    1990 799
CC    1990 656
CC    2000 980
CC    2000 812


And I want to see results displayed as follows (take the average of
the value for each name, and display by year, sorted by mean(value)):

YEAR==1990
Name mean(value)
CC   727.5
AA   615.5
BB   599.5

and

YEAR==2000
Name mean(value)
AA   599.5
BB   569.5
CC   357.5


How would I modify my existing code such that the results are
displayed in increasing order of mean(value),
so I can see easily which name had the highest mean(value)?

.table Name if Year==1990, contents(mean value)
.table Name if Year==2000, contents(mean value)

Is there an in-line sort option that goes with the table command?

Right now the result is not displayed in any specific way.


Thanks,
R
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index