Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: Re: Table command

From   "Joseph Coveney" <>
To   <>
Subject   st: Re: Table command
Date   Fri, 5 Apr 2013 12:37:52 +0900

Ching Wong wrote:

I tried to find out the number of observations, mean and sd age of
subjects by gender for the data listed below as an example (by using
the table command):

id | age | gender

1 35 Female
2 27 Female
3 29 Male
4 29 Male
5 30 Female
6 28 Male
7 32 Female
8 32 Female

I put "table age, by(gender) c(n mean sd) " into stata, however, I
have got an error message saying can't find the c or can't find sd.
Why does it happen? Did I use the wrong format of the command? Also,
what is the correct way to make a two-way table with the row of Female
and Male and the column with the obs, mean and sd?

I am actually a bit confused about the command of "table, summarize
and tabstat". It seems they are the same.


Your syntax is wrong.  Put the classification variable immediately after
-table-, and then qualify the summary statistics with the variable to be

    table gender, contents(mean age sd age n age)

-summarize- doesn't display the summary statistics in a tabular style, but
rather in a list style--you would use it in a -by- statement:

    bysort gender: summarize age

It also returns its summary statistics in return scalars.

I've never used -tabstat-, so I can't help you there beyond what you've read in
the documentation.

Joseph Coveney

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index