Statalist


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

Re: st: RE: dumb cross-tab question


From   "E. Paul Wileyto" <epw@mail.med.upenn.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: dumb cross-tab question
Date   Thu, 29 Nov 2007 08:01:45 -0500

Thanks. I have similar coding that would do it, but as you show below, it is not general.... By "quick," I meant the usual Stata one-line command.

P

Nick Cox wrote:

Depends what you mean by "quick".
I don't think that this is canned. But it can be done directly.
sysuse auto
egen group = group(for rep78)
gen ub = .
gen lb = .
gen mean = .
gen se = .
qui forval i = 1/8 {
ci mpg if group == `i'
replace ub = r(ub) if group == `i'
replace lb = r(lb) if group == `i'
replace mean = r(mean) if group == `i'
replace se = r(se) if group == `i'
}
tabdisp foreign rep78 if group < . , cell(mean se lb ub) format(%2.1f)

Nick
n.j.cox@durham.ac.uk
E. Paul Wileyto

Is there a quick way to get Stata to format a two-way table showing
means, SEs, and CIs for a third variable?

tabulate summarize doesn't seem to do SEs and CIs

tabstat gets angry if I try to give it two by variables.


*
* 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/

--
E. Paul Wileyto, Ph.D.
Assistant Professor of Biostatistics
Tobacco Use Research Center
School of Medicine, U. of Pennsylvania
3535 Market Street, Suite 4100
Philadelphia, PA 19104-3309

215-746-7147
Fax: 215-746-7140
epw@mail.med.upenn.edu
http://mail.med.upenn.edu/~epw/
*
* 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