Closed fredericky123 closed 2 years ago
Not sure. You could do the following:
sysuse auto,clear
eststo clear
eststo: quietly regress price weight mpg
eststo: quietly regress price weight mpg foreign
esttab using ~/output.rtf, order(_cons) replace indicate({\b Controls} = foreign) ///
refcat(_cons "{\b {\i Variables of main interests}}", nolab below)
But maybe this is not what you want...
just focus on your case above, I suggest using indicate() function to specify your Control Variables.
sysuse auto, clear
// since you did not specify any control variable, I use variable “length” as one.
eststo: quietly regress price weight mpg length
eststo: quietly regress price weight mpg foreign length
esttab using output.rtf, ///
refcat(_cons "{\b {\i Variables of main interests}}",nolab below) ///
order(_cons length) replace ///
indicate(“{\b Controls}” = length, label(“{\i \b include}” “”))
and you shall get
This an elegant alternative way, can we set the order of "controls" before "Variables of interest"
Thanks you all for your help!!
can we set the order of "controls" before "Variables of interest"
Cannot think of an easy solution. An approach could be to use varlabels(,elist())
to construct additional rows in the table. This is a bit involved because you have to write the complete RTF code of the row. Here's an example that can be used as a template:
sysuse auto,clear
eststo clear
eststo: quietly regress price weight mpg
eststo: quietly regress price weight mpg foreign
local B "{\trowd\trgaph108\trleft-108@rtfrowdef\pard\intbl\ql {"
local D "}\cell \pard\intbl\qc {"
local E "}\cell\row}`=char(13)'"
local c "\b Controls"
local i "\b\i included"
local ni "\b\i not included"
local v "\b\i Variables of main interest"
esttab using ~/output.rtf, order(_cons) replace ///
varlabels(,elist(_cons "`B'`c'`D'`ni'`D'`i'`E'`B'`v'`D'`D'`E'"))
Local B
contains the definition of the beginning of a table row (estout
will internally substitute @rtfrowdef
with appropriate code; this is undocumented). Local D
contains code that goes between table cells. Local E
contains code that terminates the row (=char(13)
adds a line break).
ben
Thanks so much!
The below is what I expected, two rows including "Controls" and "Variables of interest"