Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: table for differences of means test


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: table for differences of means test
Date   Mon, 23 Jul 2007 08:05:34 -0400

Something like

sysuse auto,clear
su price,meanonly
local mean= r(mean)
local enn=r(N)
ttest price,by(foreign)
di "`r(N_1)' `r(N_2)' `mean' `enn'"

See Appendix B in the book below or "A little bit of Stata programming goes a long way" working paper on the website below.

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


On Jul 23, 2007, at 2:33 AM, Hught wrote:



Thanks Kit and Ronan. One more thing - how can I include the overall
no of observations and mean (i.e. both groups of variable q2q6) in the
same table? It should look like:-

Variable N Mean N1 Mean1 N2 Mean2 p- value


Right now, I am doing it in two steps and entering the values of N and
Mean manually.
*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index