I want to export a summary statistics table into Latex that is conditional on more than one variable, as follows:
Code:
estpost sum l21_en m11_en m22_en m32_en if new_question==0 & female==0 est store old_male estpost sum l21_en m11_en m22_en m32_en if new_question==0 & female==1 est store old_female estpost sum l21_en m11_en m22_en m32_en if new_question==1 & female==0 est store new_male estpost sum l21_en m11_en m22_en m32_en if new_question==1 & female==1 est store new_female
Code:
esttab old_male old_female new_male new_female using "$results/summary2017.tex", replace /// mtitles("\textbf{Old Questionnaire_Male}" "\textbf{Old Questionnaire_female}" "\textbf{New Questionnaire Male}" "\textbf{New Questionnaire female}") /// cells("mean(fmt(2))") nolabel
\begin{tabular}{l*{4}{c}}
\hline\hline
&\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\ multicolumn{1}{c}{(3)}&\multicolumn{1}{c}{(4)}\\
&\multicolumn{1}{c}{\textbf{Old Questionnaire\_Male}}&\multicolumn{1}{c}{\textbf{O ld Questionnaire\_female}}&\multicolumn{1}{c}{\textbf {New Questionnaire Male}}&\multicolumn{1}{c}{\textbf{New Questionnaire female}}\\
& mean& mean& mean& mean\\
\hline
l21\_en & 0.36& 0.56& .& .\\
m11\_en & .& .& 0.13& 0.26\\
m22\_en & .& .& 0.01& 0.06\\
m32\_en & .& .& 0.01& 0.01\\
\hline
\(N\) & 3160& 4513& 349& 819\\
\hline\hline
\end{tabular}
Is there a way to write the mtitles option of the esttab command so that in the exported table the \multicolumn titles provide titles and sub-titles according to different conditions, i.e. like this:
\begin{tabular}{l*{4}{c}}Thanks!
\hline\hline
&\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\ multicolumn{1}{c}{(3)}&\multicolumn{1}{c}{(4)}\\
&\multicolumn{2}{c}{\textbf{Old Questionnaire}}&\multicolumn{2}{c}{\textbf{New Questionnaire}}\\
&\multicolumn{1}{c}{\textbf{Male}}&\multicolumn{1} {c}{\textbf{Female}}&\multicolumn{1}{c}{\textbf{Ma le}}&\multicolumn{1}{c}{\textbf{Female}}\\
& mean& mean& mean& mean\\
\hline
l21\_en & 0.36& 0.56& .& .\\
m11\_en & .& .& 0.13& 0.26\\
m22\_en & .& .& 0.01& 0.06\\
m32\_en & .& .& 0.01& 0.01\\
\hline
\(N\) & 3160& 4513& 349& 819\\
\hline\hline
\end{tabular}
0 Response to mtitles for titles and sub-titles within estab command
Post a Comment