--- On Mon, 1/2/10, Nuno Soares wrote:
> I was wondering if there is a way of building tables in
> Stata with a set of -ttest- results for different
> variables. The table would look something like this
> (produced in SAS, and testing for H0: mean=0):
*------------------- begin example ---------------------
sysuse auto, clear
matrix res = J(3,4,.)
local i = 1
local rown ""
foreach var of varlist mpg rep78 trunk {
ttest `var' = 0
matrix res[`i++',1] = r(N_1), r(mu_1), r(t), r(p)
local rown "`rown' `var'"
}
matrix rownames res = `rown'
matrix colnames res = N Mean t_Value Pr_>_|t|
matlist res, underscore format(%9.3g)
*------------------- end example --------------------------
( For more on how to use examples I sent to statalist see:
http://www.maartenbuis.nl/stata/exampleFAQ.html )
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* 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/