Herve STOLOWY wrote:
Dear Statalisters:
I have not used -tabout- (downloadable from ssc) for a while and face
some difficulties (even after having looked at the tutorial).
I want to get a summary two-way table with counts. This is my syntax:
tabout format_bs format_is using statdes_table5_A, replace c(count
format_is) f(0) sum stats(chi2)
format_bs and format_is are two binary variables (coded 0 or 1).
I have two questions:
1 - I have added 'format-is' after 'count' because, without a
variable name, it did not work. But I don't understand the meaning of
this variable after 'count' and the figures I get are OK.
2 - I don't get the chi2 in the output.
-tabout- uses both the output from tabulate and the output from
summarize (with the detail option) in its calculations.
In asking for a "count", you have asked for a summary statistic, that
is, the count or N (number of observations) used by summarize (with the
detail option), so the variable you feed into the cell option (c count
format-is) is the equivalent of
sum format-is, d
result returned in r(N). As the -tabout- help explains, you can also get
the same result with (n format-is) ("Note that you may enter the median
as either p50 or median and you may enter N as either N or count.")
You don't get a chi2 because that is only available with -tabulate- and
you will not get that with your syntax.
Perhaps you are after the following:
tabout format_bs format_is using statdes_table5_A, replace c(freq) f(0)
stats(chi2)
Consider the following example:
sysuse auto
tabout rep78 for using ian, rep c(count for) f(0) sum stats(chi2)
Table output written to: ian
Car type
Repair Record 1978 Domestic Foreign Total
Count for Count for Count for
1 2 0 2
2 8 0 8
3 27 3 30
4 9 9 18
5 2 9 11
Total 48 21 69
help summarize
help tabout
tabout rep78 for using ian, rep c(freq) f(0) stats(chi2)
Table output written to: ian
Car type
Repair Record 1978 Domestic Foreign Total
No. No. No.
1 2 0 2
2 8 0 8
3 27 3 30
4 9 9 18
5 2 9 11
Total 48 21 69
Pearson chi2(4) = 27.2640 Pr = 0.000
Cheers
Ian
*
* 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/