Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Limit Columns Using outreg2


From   "Chen, Lenis" <lenchen@jhsph.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Limit Columns Using outreg2
Date   Mon, 25 Jul 2011 14:12:17 -0400

When I use the code below, the outreg2 command appends a new column in the output table (in test.doc) for each regression.  Therefore, the output table generated from the code below has five columns labeled ft, five columns labeled tfr, five labeled mmse, etc. What if I only want one column per var  one column labeled ft,  one column labeled tfr, one column labeled mmse, one column labled trail, and one column labeled cesd? In other words, I want five columns total for my five var variables in the output table (rather than 5*4=20 columns in the table) and four rows representing the four name variables.

foreach var of varlist ft tfr mmse trail cesd {
foreach name of varlist se veg smoke alc {
reg `var' `name'
outreg2 using test.doc, label `append'
local append "append"
}
}

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index