我想使用 Stata 中的用户编写tabout
命令生成包含许多变量的 LaTeX 频率表。由于变量太多,表格需要跨越多页。我相信esttab
有一个选项可以生成多页乳胶表。tabout
版本 3(SSC 上尚未提供)是否具有类似的功能?
这是我用来生成表格的命令:
local cat_vars "speed_limit vehicle_maneuver road_type weather_conditions season urban daylight weekday weekend weekend_night carriageway_hazards crosswalk special_conditions taxi police_attended_scene"
// Summary of Control Variables
tabout `cat_vars' using "summary-of-controls.tex", replace ///
f(0c 1) style(tex) ///
title(Summary of Control Variables) ///
twidth(12) ///
caplab(summary-of-controls) ///
font(bold) ///
doctype(report)
LaTeX 输出结果如下:
\begin{center}
\begin{table}[H]
\caption{\label{tab:summary-of-controls}Two-way Frequency Between HEV and Control Variables} \par \vspace{2ex}
\footnotesize
\newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
\begin{tabularx} {16cm} {@{} l Y Y Y Y Y Y @{}}
\toprule
& \multicolumn{6}{c}{\textbf{HEV}} \\
\cmidrule(l{1em}){2-7}
& \multicolumn{2}{c}{\textbf{0}} & \multicolumn{2}{c}{\textbf{1}} & \multicolumn{2}{c}{\textbf{Total}} \\
\cmidrule(l{1em}){2-3}\cmidrule(l{1em}){4-5}\cmidrule(l{1em}){6-7}
& No. & \% & No. & \% & No. & \% \\
\midrule
\textbf{Speed Limit (MPH)} \\
20 & 372 & 1.3 & 8 & 8.6 & 380 & 1.4 \\
30 & 16,703 & 59.7 & 57 & 61.3 & 16,760 & 59.7 \\
40 & 2,623 & 9.4 & 5 & 5.4 & 2,628 & 9.4 \\
50 & 996 & 3.6 & 5 & 5.4 & 1,001 & 3.6 \\
60 & 4,974 & 17.8 & 9 & 9.7 & 4,983 & 17.7 \\
70 & 2,323 & 8.3 & 9 & 9.7 & 2,332 & 8.3 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Urban} \\
0 & 10,714 & 38.3 & 25 & 26.9 & 10,739 & 38.2 \\
1 & 17,277 & 61.7 & 68 & 73.1 & 17,345 & 61.8 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Daylight} \\
0 & 7,636 & 27.3 & 16 & 17.2 & 7,652 & 27.2 \\
1 & 20,355 & 72.7 & 77 & 82.8 & 20,432 & 72.8 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Weekday} \\
0 & 6,942 & 24.8 & 29 & 31.2 & 6,971 & 24.8 \\
1 & 21,049 & 75.2 & 64 & 68.8 & 21,113 & 75.2 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Weekend} \\
0 & 19,613 & 70.1 & 63 & 67.7 & 19,676 & 70.1 \\
1 & 8,378 & 29.9 & 30 & 32.3 & 8,408 & 29.9 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Weekend Night} \\
0 & 25,528 & 91.2 & 87 & 93.5 & 25,615 & 91.2 \\
1 & 2,463 & 8.8 & 6 & 6.5 & 2,469 & 8.8 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Carriageway Hazards} \\
0 & 27,478 & 98.2 & 93 & 100.0 & 27,571 & 98.2 \\
1 & 513 & 1.8 & 0 & 0.0 & 513 & 1.8 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Pedestrian Crosswalk} \\
0 & 23,726 & 84.8 & 75 & 80.6 & 23,801 & 84.7 \\
1 & 4,265 & 15.2 & 18 & 19.4 & 4,283 & 15.3 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Special Conditions} \\
0 & 27,305 & 97.5 & 92 & 98.9 & 27,397 & 97.6 \\
1 & 686 & 2.5 & 1 & 1.1 & 687 & 2.4 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Taxi} \\
0 & 26,887 & 96.1 & 93 & 100.0 & 26,980 & 96.1 \\
1 & 1,104 & 3.9 & 0 & 0.0 & 1,104 & 3.9 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Police Attended Scene} \\
0 & 5,435 & 19.4 & 19 & 20.4 & 5,454 & 19.4 \\
1 & 22,556 & 80.6 & 74 & 79.6 & 22,630 & 80.6 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Vehicle Maneuver} \\
Reversing & 351 & 1.3 & 1 & 1.1 & 352 & 1.3 \\
Parked & 488 & 1.7 & 3 & 3.2 & 491 & 1.7 \\
Waiting to go & 2,269 & 8.1 & 10 & 10.8 & 2,279 & 8.1 \\
Slowing or stopping & 1,745 & 6.2 & 7 & 7.5 & 1,752 & 6.2 \\
Moving off & 794 & 2.8 & 7 & 7.5 & 801 & 2.9 \\
Turning & 4,219 & 15.1 & 16 & 17.2 & 4,235 & 15.1 \\
Changing lane & 319 & 1.1 & 3 & 3.2 & 322 & 1.1 \\
Overtaking vehicle & 1,288 & 4.6 & 3 & 3.2 & 1,291 & 4.6 \\
Going ahead & 16,518 & 59.0 & 43 & 46.2 & 16,561 & 59.0 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Road Type} \\
Other & 688 & 2.5 & 4 & 4.3 & 692 & 2.5 \\
Roundabout & 1,787 & 6.4 & 3 & 3.2 & 1,790 & 6.4 \\
Dual carriageway & 4,731 & 16.9 & 16 & 17.2 & 4,747 & 16.9 \\
Single carriageway & 20,785 & 74.3 & 70 & 75.3 & 20,855 & 74.3 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Weather Conditions} \\
Other & 955 & 3.4 & 1 & 1.1 & 956 & 3.4 \\
Fine & 22,665 & 81.0 & 79 & 84.9 & 22,744 & 81.0 \\
Raining & 4,025 & 14.4 & 11 & 11.8 & 4,036 & 14.4 \\
Snowing & 181 & 0.6 & 1 & 1.1 & 182 & 0.6 \\
Fog or mist & 165 & 0.6 & 1 & 1.1 & 166 & 0.6 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\midrule
\textbf{Season} \\
Winter & 6,723 & 24.0 & 24 & 25.8 & 6,747 & 24.0 \\
Spring & 6,639 & 23.7 & 19 & 20.4 & 6,658 & 23.7 \\
Summer & 7,041 & 25.2 & 30 & 32.3 & 7,071 & 25.2 \\
Fall & 7,588 & 27.1 & 20 & 21.5 & 7,608 & 27.1 \\
Total & 27,991 & 100.0 & 93 & 100.0 & 28,084 & 100.0 \\
\bottomrule
\end{tabularx}
\normalsize
\end{table}
\end{center}