O alinhamento da tabela muda ao alterar o tamanho da fonte (saída etable do STATA)

O alinhamento da tabela muda ao alterar o tamanho da fonte (saída etable do STATA)

Exportei uma tabela do STATA usando a opção etable. Alterei o tamanho da fonte para minúsculo para ajustar a tabela à página do documento e usei a opção centralização. Porém, atrapalha toda a formatação da tabela. Existe uma alternativa para fazer isso? Eu tentei usar a tabela, tabularx e tabular. Nenhum deles parece funcionar. Qualquer ajuda seria apreciada

\tiny
\centering
\begin{tabular}{lllllllllll}
\cline{1-11}
\multicolumn{1}{r}{} &
  \multicolumn{2}{c}{Excellent} &
  \multicolumn{2}{c}{V.Good} &
  \multicolumn{2}{c}{Good} &
  \multicolumn{2}{c}{Fair} &
  \multicolumn{2}{c}{Poor} \\
\multicolumn{1}{r}{} &
  \multicolumn{1}{r}{} &
  \multicolumn{1}{r}{} &
  \multicolumn{1}{r}{} &
  \multicolumn{1}{r}{} &
  \multicolumn{1}{r}{} &
  \multicolumn{1}{r}{} &
  \multicolumn{1}{r}{} &
  \multicolumn{1}{r}{} &
  \multicolumn{1}{r}{} &
  \multicolumn{1}{r}{} \\
\cline{1-11}
\multicolumn{1}{l}{Prior heart attack} &
  \multicolumn{1}{r}{-0.301} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{-0.057} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.153} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.137} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.069} &
  \multicolumn{1}{l}{**} \\
\multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.023)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.006)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.012)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.010)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.006)} &
  \multicolumn{1}{l}{} \\
\multicolumn{1}{l}{Number of people in household} &
  \multicolumn{1}{r}{-0.008} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{-0.001} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.004} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.004} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.002} &
  \multicolumn{1}{l}{**} \\
\multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.003)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.000)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.001)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.001)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.001)} &
  \multicolumn{1}{l}{} \\
\multicolumn{1}{l}{Body mass index (BMI)} &
  \multicolumn{1}{r}{-0.006} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{-0.001} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.003} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.003} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.001} &
  \multicolumn{1}{l}{**} \\
\multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.001)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.000)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.000)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.000)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.000)} &
  \multicolumn{1}{l}{} \\
\multicolumn{1}{l}{Diabetes status} &
  \multicolumn{1}{r}{-0.235} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{-0.044} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.119} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.107} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.054} &
  \multicolumn{1}{l}{**} \\
\multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.022)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.005)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.012)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.010)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.005)} &
  \multicolumn{1}{l}{} \\
\multicolumn{1}{l}{30-39} &
  \multicolumn{1}{r}{-0.024} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{0.001} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{0.013} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{0.007} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{0.003} &
  \multicolumn{1}{l}{} \\
\multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.014)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.001)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.008)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.004)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.002)} &
  \multicolumn{1}{l}{} \\
\multicolumn{1}{l}{40-49} &
  \multicolumn{1}{r}{-0.098} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{-0.007} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.057} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.035} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.014} &
  \multicolumn{1}{l}{**} \\
\multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.015)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.003)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.009)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.006)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.002)} &
  \multicolumn{1}{l}{} \\
\multicolumn{1}{l}{50-59} &
  \multicolumn{1}{r}{-0.185} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{-0.043} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.106} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.086} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.036} &
  \multicolumn{1}{l}{**} \\
\multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.012)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.006)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.007)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.007)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.003)} &
  \multicolumn{1}{l}{} \\
\multicolumn{1}{l}{60-69} &
  \multicolumn{1}{r}{-0.237} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{-0.084} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.125} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.133} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.063} &
  \multicolumn{1}{l}{**} \\
\multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.010)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.006)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.006)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.007)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.004)} &
  \multicolumn{1}{l}{} \\
\multicolumn{1}{l}{70+} &
  \multicolumn{1}{r}{-0.248} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{-0.096} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.127} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.146} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.071} &
  \multicolumn{1}{l}{**} \\
\multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.012)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.009)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.006)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.011)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.007)} &
  \multicolumn{1}{l}{} \\
\multicolumn{1}{l}{Black} &
  \multicolumn{1}{r}{-0.165} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{-0.031} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.083} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.075} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.037} &
  \multicolumn{1}{l}{**} \\
\multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.013)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.003)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.007)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.006)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.003)} &
  \multicolumn{1}{l}{} \\
\multicolumn{1}{l}{Female} &
  \multicolumn{1}{r}{-0.039} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{-0.007} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.020} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.018} &
  \multicolumn{1}{l}{**} &
  \multicolumn{1}{r}{0.009} &
  \multicolumn{1}{l}{**} \\
\multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.008)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.002)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.004)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.004)} &
  \multicolumn{1}{l}{} &
  \multicolumn{1}{r}{(0.002)} &
  \multicolumn{1}{l}{} \\
\cline{1-11}
\end{tabular}

\footnotesize{
** p$<$.01, * p$<$.05
}

Responder1

Seria mais fácil exportar dados para R e usar um de seus plugins kable(veja omanual), que produz tabelas bastante decentes.

O problema do código gerado em questão é o excesso de colunas tornando a tabela muito larga. É por isso que você deve usar uma fonte muito pequena para caber. A outra questão está relacionada ao código, pois contém muito conteúdo redundante.

No exemplo abaixo, existem duas macros \ponee \ptwoque adicionam anotações – veja o primeiro valor. Percebi que o mesmo p < 0.05é relatado em toda a tabela, exceto em uma linha. Não seria mais fácil relatar o que é NOT p < 0.05? Como exemplo, coloquei uma “adaga” nessa linha e uma anotação que explica seu significado. Há também um comprimento personalizado que controla o espaçamento entre os valores principais e mantém as estatísticas com incertezas juntas.

O código:

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}

\newcommand\pone{\rlap{\textsuperscript{*}}}
\newcommand\ptwo{\rlap{\textsuperscript{**}}}
\newlength\vdist\setlength\vdist{4pt}
\setlength\cmidrulewidth{0.3pt}


\begin{document}
\begin{table}[tbh]
  \setlength\tabcolsep{9pt}
  \newcommand\xth[1]{\makebox[0pt][c]{\normalsize#1}}
  %
  \small
  \centering
  \caption{Caption}\label{tab:label-for-table}
  \vspace{3pt}
  \begin{tabular}{@{}l @{\hspace{2em}} *5{c} @{}}
    \toprule
    & \xth{Excellent} & \xth{V. Good} & \xth{Good} & \xth{Fair} & \xth{Poor} \\
    \midrule
    Prior heart attack
    & -0.301\ptwo  & -0.057  & 0.153   & 0.137   & 0.069 \\
    & (0.023) & (0.006) & (0.012) & (0.010) & (0.006) \\ \addlinespace[\vdist]
    Number of people in
    & -0.008  & -0.001  & 0.004   & 0.004   & 0.002 \\
    household & (0.003) & (0.000) & (0.001) & (0.001) & (0.001) \\ \addlinespace[\vdist] 
    Body mass index (BMI)
    & -0.006  & -0.001  & 0.003   & 0.003   & 0.001 \\
    & (0.001) & (0.000) & (0.000) & (0.000) & (0.000) \\ \addlinespace[\vdist] 
    Diabetes status
    & -0.235  & -0.044  & 0.119   & 0.107   & 0.054 \\
    & (0.022) & (0.005) & (0.012) & (0.010) & (0.005) \\ \cmidrule{2-6}
    30-39$^{\dag}$
    & -0.024  & 0.001   & 0.013   & 0.007   & 0.003 \\
    & (0.014) & (0.001) & (0.008) & (0.004) & (0.002) \\ \addlinespace[\vdist] 
    40-49
    & -0.098  & -0.007  & 0.057   & 0.035   & 0.014 \\
    & (0.015) & (0.003) & (0.009) & (0.006) & (0.002) \\ \addlinespace[\vdist] 
    50-59
    & -0.185  & -0.043  & 0.106   & 0.086   & 0.036 \\
    & (0.012) & (0.006) & (0.007) & (0.007) & (0.003) \\ \addlinespace[\vdist] 
    60-69
    & -0.237  & -0.084  & 0.125   & 0.133   & 0.063 \\
    & (0.010) & (0.006) & (0.006) & (0.007) & (0.004) \\ \addlinespace[\vdist] 
    70+
    & -0.248  & -0.096  & 0.127   & 0.146   & 0.071 \\
    & (0.012) & (0.009) & (0.006) & (0.011) & (0.007) \\ \cmidrule{2-6}
    Black
    & -0.165  & -0.031  & 0.083   & 0.075   & 0.037 \\
    & (0.013) & (0.003) & (0.007) & (0.006) & (0.003) \\  \addlinespace[\vdist]
    Female
    & -0.039  & -0.007  & 0.020   & 0.018   & 0.009 \\
    & (0.008) & (0.002) & (0.004) & (0.004) & (0.002) \\
    \bottomrule
    \multicolumn{6}{@{}l}{\footnotesize $^{\dag}$ $p < 0.05$ except for this row}\\
  \end{tabular}
\end{table}
\end{document}

insira a descrição da imagem aqui

informação relacionada