# Re: st: RE: Summary statistics table problem

 From George Hoffman To Subject Re: st: RE: Summary statistics table problem Date Tue, 28 Oct 2008 19:43:22 -0500

```Matt-
In Martin's solution, the x is just a dummy.
The rows are the contents - means of the var1 .. Varn - for each value of x,
which in this case is just a single dummy entry.
The columns are the values of rep78 - which are labels by their values
Thanks for your thoughts - I'm thinking there is already a way to do this
that I'm somehow overlooking, because it seems like a common function.
George

On 10/28/08 7:29 PM, "Matt Spittal" <Matt.Spittal@cancervic.org.au> wrote:

> George,
>
> Adding labels to the table is no problem.  You just need to define what the
> labels are first with the -label define- and -label values- commands.  Here is
> an illustration:
>
> // Martin's code
> sysuse auto, clear
> generate x = 1
>
> label define rep78 1 "Very good" 2 "Good" 3 "Average" 4 "Poor" 5 "Very poor"
> label values rep78 rep78
> table x rep78, contents(mean price mean mpg)
>
> -- Matt
> matt.spittal@cancervic.org.au
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of George Hoffman
> Sent: Wednesday, 29 October 2008 11:18 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: RE: Summary statistics table problem
>
>
> Martin -
> Yes, this works, except for no row labels, but I can live with this.
> I might be inspired to write something to 'fix' this problem.
>
> George
>
>
>
> On 10/28/08 7:17 AM, "Martin Weiss" <martin.weiss1@gmx.de> wrote:
>
>> Even dirtier:
>>
>> *********
>> sysuse auto, clear
>> g x=1
>> table x rep78, contents(mean price mean mpg )
>> *********
>>
>>
>> HTH
>> Martin
>>
>>
>> -----Original Message-----
>> From: owner-statalist@hsphsun2.harvard.edu
>> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of George Hoffman
>> Sent: Tuesday, October 28, 2008 12:58 PM
>> To: statalist@hsphsun2.harvard.edu
>> Subject: Re: st: RE: Summary statistics table problem
>>
>> Martin -
>> thanks, but not quite.
>> Tabstat var1 var2 ... Varn, stat(mean) by(byvar) either:
>> col(var): yields columns of the var1, var2, with the by(byvar) as rows
>> Col(stat): yields sequential single columns of output for each var1..varn
>>
>> I'm looking for the by(byvar) to appear in columns side by side, with rows
>> for var1...varn
>>
>> george
>>
>> On 10/28/08 3:13 AM, "Martin Weiss" <martin.weiss1@gmx.de> wrote:
>>
>>> -tabstat var1 var2, statistics( mean ) by(Hour6) nototal
>> columns(variables)-
>>> ?
>>>
>>>
>>> HTH
>>> Martin
>>>
>>> -----Original Message-----
>>> From: owner-statalist@hsphsun2.harvard.edu
>>> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of George Hoffman
>>> Sent: Tuesday, October 28, 2008 4:18 AM
>>> To: statalist@hsphsun2.harvard.edu
>>> Subject: st: Summary statistics table problem
>>>
>>> This should be simple, but I can't find a straightforward way to do this.
>>> Xt  dataset, with hours 1-48 for time, also summarized by hour6 (1-6,
>>> 7-12,...)
>>> Many row variables.
>>>
>>> I want a table of means by hour6:
>>>
>>> Var         Hour6
>>>             1       2       3       4       5       6       7       8
>>> var1        50      55      55      57      60      62      61      57
>>> var2        47      34      23      12      6       5       7       6
>>> Etc
>>>
>>> ?? Thank you,
>>> George hoffman
>>>
>>>
>>> *
>>> *   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/
```