I am trying to extract the results of a series of regressions into one table, but am struggling to articulate my outreg2 command properly.
As an example of what I'm trying to do, suppose I use auto.dta to run the following regressions:
I want to extract the results of these regressions into a table that looks like this:

Ideally, the code would produce both a Word doc with a table that looks like this and the associated .tex code
I am not very familiar with outreg2 (or other similar commands), however, and am struggling to produce this output. I tried the following code, but it's not really close to doing what I want.
As an example of what I'm trying to do, suppose I use auto.dta to run the following regressions:
Code:
sysuse auto, clear /*======================================================================= Foreign cars ========================================================================*/ * Full sample reg price if foreign == 1 reg price mpg if foreign == 1 * Full sample reg price if foreign == 1 reg price mpg if foreign == 1 * Weight over 2,500 reg price if foreign == 1 & weight >= 2500 reg price mpg if foreign == 1 & weight >= 2500 * Weight under 2,500 reg price if foreign == 1 & weight < 2500 reg price mpg if foreign == 1 & weight < 2500 /*======================================================================= Domestic cars ========================================================================*/ * Full sample reg price if foreign == 0 reg price mpg if foreign == 0 * Weight over 2,500 reg price if foreign == 0 & weight >= 2500 reg price mpg if foreign == 0 & weight >= 2500 * Weight under 2,500 reg price if foreign == 0 & weight < 2500 reg price mpg if foreign == 0 & weight < 2500
Ideally, the code would produce both a Word doc with a table that looks like this and the associated .tex code
Code:
\begin{table}[] \begin{tabular}{lllll} \hline \multicolumn{1}{|l|}{\textbf{}} & \multicolumn{2}{l|}{\textbf{Foreign cars}} & \multicolumn{2}{l|}{\textbf{Domestic cars}} \\ \hline \multicolumn{1}{|l|}{\textbf{Subgroup}} & \multicolumn{1}{l|}{\textbf{Average price}} & \multicolumn{1}{l|}{\textbf{MPG coefficient}} & \multicolumn{1}{l|}{\textbf{Average price}} & \multicolumn{1}{l|}{\textbf{MPG coefficient}} \\ \hline Full sample & 6385 & \begin{tabular}[c]{@{}l@{}}-250\\ {[}68{]}***\end{tabular} & 6072 & \begin{tabular}[c]{@{}l@{}}-329\\ {[}80{]}***\end{tabular} \\ Weight \textgreater{}= 2500 & 9710 & \begin{tabular}[c]{@{}l@{}}-272\\ {[}314{]}\end{tabular} & 6320 & \begin{tabular}[c]{@{}l@{}}-464\\ {[}117{]}***\end{tabular} \\ Weight \textless{}= 2500 & 5137 & \begin{tabular}[c]{@{}l@{}}-79\\ {[}45{]}\end{tabular} & 4172 & \begin{tabular}[c]{@{}l@{}}-24\\ {[}72{]}\end{tabular} \end{tabular} \end{table}
Code:
/*======================================================================= Foreign cars ========================================================================*/ * Full sample reg price if foreign == 1 outreg2 using "/Users/NoahSpencer/Desktop/outreg_testing/table", replace aster(se) dec(0) br nose noobs nor2 nonotes reg price mpg if foreign == 1 outreg2 using "/Users/NoahSpencer/Desktop/outreg_testing/table", aster(se) dec(0) br noobs nor2 nonotes nocons * Weight over 2,500 reg price if foreign == 1 & weight >= 2500 outreg2 using "/Users/NoahSpencer/Desktop/outreg_testing/table", aster(se) dec(0) br nose noobs nor2 nonotes reg price mpg if foreign == 1 & weight >= 2500 outreg2 using "/Users/NoahSpencer/Desktop/outreg_testing/table", aster(se) dec(0) br noobs nor2 nonotes nocons * Weight under 2,500 reg price if foreign == 1 & weight < 2500 outreg2 using "/Users/NoahSpencer/Desktop/outreg_testing/table", aster(se) dec(0) br nose noobs nor2 nonotes reg price mpg if foreign == 1 & weight < 2500 outreg2 using "/Users/NoahSpencer/Desktop/outreg_testing/table", aster(se) dec(0) br noobs nor2 nonotes nocons