Hi Statalisters,
My problem involves using the excellent outreg (SCC) command to produce completely formatted tables of estimation results for use in Word or LaTex. In this case my example is using LaTex.
I want to produce a table with one column listing unadjusted results from a regression model (in this case using logistic command and the low birth weight dataset as an example) and then in a column next to it have a multivariate model with the same variables ie adjusted.
The code below produces a table that is very close to what I would like but not quite there. Here I build the unadjusted model using the append option, save it, then build the adjusted model and merge together. For the race variable which has three categories I use the addrow option so I can show the reference category with the OR of 1.0. I add this to thje adjusted model by using the keep option and replaying the outreg command.
My problem is that the adjusted model estimates are not lining up properly. I have been assuming the the rtitles suboption would line all the rows up but it is not quite working. See "Incorrect Table". The attached file "correct Table" illustrates what I want by doing some post processing in LaTex. Ideally I don't want to have to do any post processing.
Please note that if I don't use the addrow option then I can get them to line up without issue. But have the reference category makjes for a better looking table and aids interpretation.
I hope that all makes sense.
Cheers
Kevan
My problem involves using the excellent outreg (SCC) command to produce completely formatted tables of estimation results for use in Word or LaTex. In this case my example is using LaTex.
I want to produce a table with one column listing unadjusted results from a regression model (in this case using logistic command and the low birth weight dataset as an example) and then in a column next to it have a multivariate model with the same variables ie adjusted.
The code below produces a table that is very close to what I would like but not quite there. Here I build the unadjusted model using the append option, save it, then build the adjusted model and merge together. For the race variable which has three categories I use the addrow option so I can show the reference category with the OR of 1.0. I add this to thje adjusted model by using the keep option and replaying the outreg command.
My problem is that the adjusted model estimates are not lining up properly. I have been assuming the the rtitles suboption would line all the rows up but it is not quite working. See "Incorrect Table". The attached file "correct Table" illustrates what I want by doing some post processing in LaTex. Ideally I don't want to have to do any post processing.
Please note that if I don't use the addrow option then I can get them to line up without issue. But have the reference category makjes for a better looking table and aids interpretation.
I hope that all makes sense.
Cheers
Kevan
Code:
set more off webuse lbw logit low age outreg, bdec(2) nosubstat stats(e_b e_ci_l e_ci_u p) nostar /// varlabels nocons noautosumm /// ctitles("Model 1" \ "Low Birthweight", "OR", "[95\% Conf.", /// "Interval]" , "p-value") /// tex replace logit low lwt outreg, bdec(2) nosubstat stats(e_b e_ci_l e_ci_u p) nostar /// varlabels nocons noautosumm /// ctitles("Model 1" \ "Low Birthweight", "OR", "[95\% Conf.", /// "Interval]" , "p-value") /// tex append logit low smoke outreg, bdec(2) nosubstat stats(e_b e_ci_l e_ci_u p) nostar /// varlabels nocons noautosumm /// ctitles("Model 1" \ "Low Birthweight", "OR", "[95\% Conf.", /// "Interval]" , "p-value") /// tex append logit low ptl outreg, bdec(2) nosubstat stats(e_b e_ci_l e_ci_u p) nostar /// varlabels nocons noautosumm /// ctitles("Model 1" \ "Low Birthweight", "OR", "[95\% Conf.", /// "Interval]" , "p-value") /// tex append logit low ht outreg, bdec(2) nosubstat stats(e_b e_ci_l e_ci_u p) nostar /// varlabels nocons noautosumm /// ctitles("Model 1" \ "Low Birthweight", "OR", "[95\% Conf.", /// "Interval]" , "p-value") /// tex append logit low ui outreg, bdec(2) nosubstat stats(e_b e_ci_l e_ci_u p) nostar /// varlabels nocons noautosumm /// addrow("Racial Origin" \ " Ref ", "1.0" , "-", "-", "-" ) /// ctitles("Model 1" \ "Low Birthweight", "OR", "[95\% Conf.", /// "Interval]" , "p-value") /// tex append logit low i.race outreg, bdec(2) nosubstat stats(e_b e_ci_l e_ci_u p) nostar /// varlabels nocons noautosumm /// ctitles("Model 1" \ "Low Birthweight", "OR", "[95\% Conf.", /// "Interval]" , "p-value") /// tex append outreg , store(unadj) replay replace /// rtitles( " age" \ " wt" \ "smoke" \ "ptl" \ /// "ht" \ "ur" \ "Racial Origin" \ "white" \ /// " black" \ " other" ) /// coljust(l;c) nostar tex landscape /// Add Adjusted Model with label in column logit low age lwt smoke ptl ht ui i.race outreg, bdec(2) nosubstat stats(e_b e_ci_l e_ci_u p) nostar /// addrow("Racial Origin" \ " Ref ", "1.0" , "-", "-", "-" ) /// nocons noautosumm keep(age lwt smoke ptl ht ui) /// ctitles("", "Model 2" \ "Low Birthweight", "OR", "[95\% Conf.", /// "Interval]" , "p-value") /// tex multicol(1,2,2) outreg, append bdec(2) nosubstat stats(e_b e_ci_l e_ci_u p) nostar /// nocons noautosumm keep(2.race 3.race) /// ctitles("", "Model 2" \ "Low Birthweight", "OR", "[95\% Conf.", /// "Interval]" , "p-value") /// tex multicol(1,2,2) landscape outreg , store(adj) replay replace /// rtitles( " age" \ " wt" \ "smoke" \ "ptl" \ /// "ht" \ "ur" \ "Racial Origin" \ "white" \ /// " black" \ " other" ) /// coljust(l;c) nostar tex landscape outreg , replay(unadj) replace /// rtitles( " age" \ " wt" \ "smoke" \ "ptl" \ /// "ht" \ "ur" \ "Racial Origin" \ "white" \ /// " black" \ " other" ) /// coljust(l;c) nostar tex landscape outreg using unadj_adj , merge(unadj) store(unadj_adj) bdec(2) nosubstat stats(e_b e_ci_l e_ci_u p) nostar /// varlabels nocons noautosumm /// ctitles("", "Model 2" \ "Low Birthweight", "OR", "[95\% Conf.", /// "Interval]" , "p-value") /// rtitles( " age" \ " wt" \ "smoke" \ "ptl" \ /// "ht" \ "ur" \ "Racial Origin" \ "white" \ /// " black" \ " other" ) /// tex multicol(1,2,2) landscape