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: Table from loop

From   Sergio Prada <[email protected]>
To   [email protected]
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.

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)

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

Any suggestions would be highly appreciated.


*   For searches and help try:

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