Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: tables with makematrix and estout

From   "Elizabeth Gifford, Ph.D." <>
To   "" <>
Subject   st: tables with makematrix and estout
Date   Tue, 6 Dec 2011 20:57:52 +0000

Hi there
I was wondering if anyone know a tip for adding the chi-sq or ttests
to a table of means by group. =A0I'm really close but currently have the
chi-sq and p-values appearing in every row after the mean of a given
group. =A0(see below).

 This program uses two user written programs: estout (by=A0Jann, Ben)
and makematrix (by Nick Cox)

ssc install estout, replace

 ssc install makematrix


sysuse auto,clear
makematrix chi_p, from(r(chi2) r(p)) lhs( price mpg trunk weight) :
tab foreign, chi2

estpost tabstat price mpg trunk weight, by(foreign) =A0statistics(mean
sd) columns(statistics)
estadd matrix chi_p=3D chi_p

esttab , cells("mean =A0chi_p[1] (transpose) chi_p[2] (transpose)")
unstack label compress
*I have a work around that involves taking the e(mean) matrix after
the tabstat command but I was hoping for a simpler solution.
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index