For the result you want the model's have to be stacked, which is not
directly supported by -estout-. However, see:
http://repec.org/bocode/e/estout/advanced.html#advanced901
Example:
capt prog drop appendmodels
*! version 1.0.0 14aug2007 Ben Jann
program appendmodels, eclass
// using first equation of model
version 8
syntax namelist
tempname b V tmp
foreach name of local namelist {
qui est restore `name'
mat `tmp' = e(b)
local eq1: coleq `tmp'
gettoken eq1 : eq1
mat `tmp' = `tmp'[1,"`eq1':"]
local cons = colnumb(`tmp',"_cons")
if `cons'<. & `cons'>1 {
mat `tmp' = `tmp'[1,1..`cons'-1]
}
mat `b' = nullmat(`b') , `tmp'
mat `tmp' = e(V)
mat `tmp' = `tmp'["`eq1':","`eq1':"]
if `cons'<. & `cons'>1 {
mat `tmp' = `tmp'[1..`cons'-1,1..`cons'-1]
}
capt confirm matrix `V'
if _rc {
mat `V' = `tmp'
}
else {
mat `V' = ///
( `V' , J(rowsof(`V'),colsof(`tmp'),0) ) \ ///
( J(rowsof(`tmp'),colsof(`V'),0) , `tmp' )
}
}
local names: colfullnames `b'
mat coln `V' = `names'
mat rown `V' = `names'
eret post `b' `V'
eret local cmd "whatever"
end
eststo clear
sysuse auto
foreach v of varlist price mpg weight {
eststo `v': logit foreign `v'
}
appendmodels price mpg weight
estout ., eform cells("b(fmt(3)) p ci" se(par)) eqlabels(none)
This result in:
. estout ., eform cells("b(fmt(3)) p ci" se(par)) eqlabels(none)
---------------------------------------------------
.
b/se p ci95
---------------------------------------------------
price 1.000 0.676 1.000,1.000
(0.000)
mpg 1.173 0.002 1.058,1.301
(0.062)
weight 0.997 0.000 0.996,0.999
(0.001)
---------------------------------------------------
ben
On Tue, Nov 24, 2009 at 12:28 PM, Richard Hiscock
<[email protected]> wrote:
> Hi everyone,
>
> I am trying to automate results from univariable logistic regression into
> table using estout package,
> my command lines are:
>
> ****Unadjusted
> local tablist arm asa antib_proph act_lab antib_24 cs_type
> set more off
> foreach v of varlist `mylist' {
> eststo: logistic infection_any `v'
> }
> estout * , eform cells("b(fmt(1)) p(fmt(2)) ci(fmt(1)) " se(par fmt(2)))
> style(fixed) drop(_cons) modelwidth(10)
>
> this produces output as desired except that variables are stacked/staggered
> across table (see below). the staggering is not corrected
> by saving as a txt file.
> Is it possible to arrange est1-est6 in a vertical stack like:
>
> arm b/se p ci95
> asa b/se p ci95
> antib_proph ...
>
>
> I have searched the estout help file and can't identify a solution.
> thanks Richard Hiscock
>
>
> . estout * , eform cells("b(fmt(1)) p(fmt(2)) ci(fmt(1)) " se(par fmt(2)))
> style(fixed) drop(_cons) modelwidth(10)
>
> est1 est2
> est3 e
>> st4 est5 est6
> b/se p ci95 b/se p
> ci95 b/se p ci95 b
>> /se p ci95 b/se p ci95 b/se
>> p ci95
> arm 0.6 0.37 0.2,1.7
>>
> (0.33)
>>
> asa 1.0 0.96
> 0.5,1.9
>>
> (0.33)
>>
> antib_proph
> 1.3 0.73 0.3,6.6
>>
>
> (1.09)
>>
> act_lab
>> 1.1 0.89 0.4,2.8
>
> (0.
>> 52)
> antib_24
>> 3.6 0.37 0.2,59.8
>
>> (5.15)
> cs_type
>> 1.0
>> 0.94 0.4,2.6
>
>> (0.49)
>
> *
> * 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/
>
*
* 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/