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: Re: Table command
From
"Joseph Coveney" <[email protected]>
To
<[email protected]>
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
summarized:
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:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/