![如何创建给定样式的描述统计表?](https://linux22.com/image/441913/%E5%A6%82%E4%BD%95%E5%88%9B%E5%BB%BA%E7%BB%99%E5%AE%9A%E6%A0%B7%E5%BC%8F%E7%9A%84%E6%8F%8F%E8%BF%B0%E7%BB%9F%E8%AE%A1%E8%A1%A8%EF%BC%9F.png)
答案1
开始一些事情
\documentclass[landscape]{article}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}
\noindent{\centering\scriptsize
\begin{tabular}{lSSSSSS}
\toprule
& \multicolumn{3}{l}{Insured} & \multicolumn{3}{l}{Uninsured}\\
\cmidrule(lr){2-4}\cmidrule(l){5-7}
Variable & {Weighted mean} & {Minimum} & {Maximum} & {Weighted mean} & {Minimum} & {Maximum} \\
\midrule
Social cohesion at commune level (1 low to 5 high) & 4.121 & 3.646 & 4.750 & 4.103 & 3.646 & 4.453 \\
\bottomrule
\end{tabular}
}
\end{document}
答案2
我不熟悉stata
命令和语法(因为我刚开始使用它),但是,如果它生成一些表,您可以手动重新格式化。
上表是通过使用包和tabularray
加载包的两个库生成的:booktabs
siunitx
\documentclass[landscape]{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\begin{document}
\begin{table}
\centering
\sisetup{table-format=2.3}
\caption{???}
\label{tab:statistic?}
\begin{tblr}{colspec= {Q[l,m,wd=0.4\linewidth] *{3}{Q[m,c,si]}},
row{1} = {font=\bfseries},
row{3-Y} = {belowsep=3pt}
}
\toprule
\SetCell[r=2]{c}
& \SetCell[c=3]{c} {{{Insured}}}
& & & \SetCell[c=3]{c} {{{Uninsured}}}
& & \\
\cmidrule[lr]{2-4}\cmidrule[l]{5-7}
Variable
& {{{Weighted mean}}} & {{{Minimum}}} & {{{Maximum}}}
& {{{Weighted mean}}} & {{{Minimum}}} & {{{Maximum}}} \\
\midrule
Social cohesion at commune level (1 low to 5 high)
& 4.121 & 3.646 & 4.750 & 4.103 & 3.646 & 4.453 \\
Index of networks ...
&16.058 & 5.521 &49,147 &12.478 & 2.796 &49.147 \\
%
Income (annual consumption expenditure '000s VND
& \num{13 709} & \num{840} & \num{103 944}
& \num{13 532} & \num{432} & \num{168 000} \\
%
\bottomrule
\end{tblr}
\end{table}
\end{document}
表格并不完整,但缺失的行应该很容易添加。