I am using the estout command to prepare my tables in Latex. Since I have lot of tables and I change them ofthen, I would like to automate everything so I minimize manual edit. Here is an example of the command I am using:
estout model* using "C:\Users\asmobari\Box Sync\Projects\MP_Project\WriteUp\tabfig_MP\model1. tex", ///
keep(t post post_T _cons) varlabels(post Post t Treatment post_T DiD _cons Constant) ///
cells(b(star fmt(2)) se(par fmt(2))) stats(r2 N, labels("R-squared""Obs")) ///
numbers collabels(none) mlabels(,titles) ///
style(tex) replace
This produces me the following Latex file:
& (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9) \\
& Male & Female &All Students & Male & Female &All Students & Male & Female &All Students \\
Treatment & 0.35 & -5.11 & 0.05 & 21.10* & 19.09 & 26.07* & -3.20 & 1.64 & -1.75 \\
& (8.16) & (14.72) & (7.33) & (9.87) & (16.02) & (9.62) & (8.37) & (4.46) & (6.68) \\
Post & -8.29 & -10.94 & -7.35 & 19.15 & 21.87 & 22.84 & -10.82 & 4.94 & -5.94 \\
& (7.66) & (14.41) & (6.51) & (12.62) & (16.14) & (11.98) & (5.83) & (4.27) & (5.49) \\
DiD & 7.81 & 0.95 & 3.68 & -14.75 & -29.20 & -27.56 & 6.88 & 5.31 & 0.20 \\
& (11.41) & (18.35) & (10.45) & (13.89) & (22.02) & (14.02) & (9.41) & (8.85) & (10.01) \\
Constant & 195.25***& 187.05***& 190.88***& 67.82***& 60.15***& 62.49***& 40.92***& 22.63** & 52.96***\\
& (5.92) & (12.15) & (5.48) & (8.98) & (10.84) & (8.55) & (6.51) & (6.21) & (5.98) \\
R-squared & 0.02 & 0.04 & 0.02 & 0.16 & 0.06 & 0.14 & 0.03 & 0.04 & 0.02 \\
Obs & 59.00 & 51.00 & 71.00 & 59.00 & 51.00 & 71.00 & 59.00 & 51.00 & 71.00 \\ However, I want to have horizontal line between the Constant and R-squared and a line space between R-squared and Obs. Manually I can do it as bellow:
& (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9) \\
& Male & Female &All Students & Male & Female &All Students & Male & Female &All Students \\
Treatment & 0.35 & -5.11 & 0.05 & 21.10* & 19.09 & 26.07* & -3.20 & 1.64 & -1.75 \\
& (8.16) & (14.72) & (7.33) & (9.87) & (16.02) & (9.62) & (8.37) & (4.46) & (6.68) \\
Post & -8.29 & -10.94 & -7.35 & 19.15 & 21.87 & 22.84 & -10.82 & 4.94 & -5.94 \\
& (7.66) & (14.41) & (6.51) & (12.62) & (16.14) & (11.98) & (5.83) & (4.27) & (5.49) \\
DiD & 7.81 & 0.95 & 3.68 & -14.75 & -29.20 & -27.56 & 6.88 & 5.31 & 0.20 \\
& (11.41) & (18.35) & (10.45) & (13.89) & (22.02) & (14.02) & (9.41) & (8.85) & (10.01) \\
Constant & 195.25***& 187.05***& 190.88***& 67.82***& 60.15***& 62.49***& 40.92***& 22.63** & 52.96***\\
& (5.92) & (12.15) & (5.48) & (8.98) & (10.84) & (8.55) & (6.51) & (6.21) & (5.98) \\
\midrule
R-squared & 0.02 & 0.04 & 0.02 & 0.16 & 0.06 & 0.14 & 0.03 & 0.04 & 0.02 \\
\addlinespace
Obs & 59.00 & 51.00 & 71.00 & 59.00 & 51.00 & 71.00 & 59.00 & 51.00 & 71.00 \\
But I wonder if I can give this instruction in my stata code so I don't have to open my latex file each time I change my regression. I would be glad if somebody could help me with it. Thanks in advance!
estout model* using "C:\Users\asmobari\Box Sync\Projects\MP_Project\WriteUp\tabfig_MP\model1. tex", ///
keep(t post post_T _cons) varlabels(post Post t Treatment post_T DiD _cons Constant) ///
cells(b(star fmt(2)) se(par fmt(2))) stats(r2 N, labels("R-squared""Obs")) ///
numbers collabels(none) mlabels(,titles) ///
style(tex) replace
This produces me the following Latex file:
& (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9) \\
& Male & Female &All Students & Male & Female &All Students & Male & Female &All Students \\
Treatment & 0.35 & -5.11 & 0.05 & 21.10* & 19.09 & 26.07* & -3.20 & 1.64 & -1.75 \\
& (8.16) & (14.72) & (7.33) & (9.87) & (16.02) & (9.62) & (8.37) & (4.46) & (6.68) \\
Post & -8.29 & -10.94 & -7.35 & 19.15 & 21.87 & 22.84 & -10.82 & 4.94 & -5.94 \\
& (7.66) & (14.41) & (6.51) & (12.62) & (16.14) & (11.98) & (5.83) & (4.27) & (5.49) \\
DiD & 7.81 & 0.95 & 3.68 & -14.75 & -29.20 & -27.56 & 6.88 & 5.31 & 0.20 \\
& (11.41) & (18.35) & (10.45) & (13.89) & (22.02) & (14.02) & (9.41) & (8.85) & (10.01) \\
Constant & 195.25***& 187.05***& 190.88***& 67.82***& 60.15***& 62.49***& 40.92***& 22.63** & 52.96***\\
& (5.92) & (12.15) & (5.48) & (8.98) & (10.84) & (8.55) & (6.51) & (6.21) & (5.98) \\
R-squared & 0.02 & 0.04 & 0.02 & 0.16 & 0.06 & 0.14 & 0.03 & 0.04 & 0.02 \\
Obs & 59.00 & 51.00 & 71.00 & 59.00 & 51.00 & 71.00 & 59.00 & 51.00 & 71.00 \\ However, I want to have horizontal line between the Constant and R-squared and a line space between R-squared and Obs. Manually I can do it as bellow:
& (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9) \\
& Male & Female &All Students & Male & Female &All Students & Male & Female &All Students \\
Treatment & 0.35 & -5.11 & 0.05 & 21.10* & 19.09 & 26.07* & -3.20 & 1.64 & -1.75 \\
& (8.16) & (14.72) & (7.33) & (9.87) & (16.02) & (9.62) & (8.37) & (4.46) & (6.68) \\
Post & -8.29 & -10.94 & -7.35 & 19.15 & 21.87 & 22.84 & -10.82 & 4.94 & -5.94 \\
& (7.66) & (14.41) & (6.51) & (12.62) & (16.14) & (11.98) & (5.83) & (4.27) & (5.49) \\
DiD & 7.81 & 0.95 & 3.68 & -14.75 & -29.20 & -27.56 & 6.88 & 5.31 & 0.20 \\
& (11.41) & (18.35) & (10.45) & (13.89) & (22.02) & (14.02) & (9.41) & (8.85) & (10.01) \\
Constant & 195.25***& 187.05***& 190.88***& 67.82***& 60.15***& 62.49***& 40.92***& 22.63** & 52.96***\\
& (5.92) & (12.15) & (5.48) & (8.98) & (10.84) & (8.55) & (6.51) & (6.21) & (5.98) \\
\midrule
R-squared & 0.02 & 0.04 & 0.02 & 0.16 & 0.06 & 0.14 & 0.03 & 0.04 & 0.02 \\
\addlinespace
Obs & 59.00 & 51.00 & 71.00 & 59.00 & 51.00 & 71.00 & 59.00 & 51.00 & 71.00 \\
But I wonder if I can give this instruction in my stata code so I don't have to open my latex file each time I change my regression. I would be glad if somebody could help me with it. Thanks in advance!
Comment