Bookmark and Share

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


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

st: Table from loop


From   Sergio Prada <sprada1@umbc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Table from loop
Date   Mon, 31 Jan 2011 22:12:21 -0500

Hi, I'd like to create a Table out of the following loop. I am using
Stata 11 for Windows.

*****************************
clear
webuse nhanes2f
svyset psuid [pweight=finalwgt], strata(stratid)
gen sample=(age<50)

foreach i of var height weight  {
 eststo clear
 svy, subpop(sample): mean `i', over(race sex)
 quietly bys race: eststo: quietly svy linearized, subpop(sample) :
regress `i' sex
 esttab, label nodepvar nonumber title(Table for variable `i')
}
********************************
The table I'd like look like this (see below) with race in columns
(White, Black and Other)

                                   White
                     Male       Female       Diff
 Height         176.89      163.21   -13.68***
 Weight          79.26        63.98   -15.27***

Any suggestions would be highly appreciated.

Thanks,


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


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