-1
\begin{table}[htbp]%\caption{Summary statistics}

    \centering
    \scriptsize
    \renewcommand\arraystretch{0.8}
    \setlength\tabcolsep{2pt}
    \begin{tabular}{@{}lS[table-format=-2.8,table-align-text-post=false]@{\,}rS[table-format=-2.6,table-align-text-post=false]@{\,}rS[table-format=-2.8,table-align-text-post=false]@{\,}r@{}}
        \toprule
        &   \multicolumn{1}{c}{(1)}
        &   \multicolumn{1}{c}{(2)}
        &   \multicolumn{1}{c}{(3)}       \\
        \cmidrule(ll){2-3}\cmidrule(ll){4-5}\cmidrule(ll){6-7}
        & {netinmargin}
             & {liqdtyratio}
            & {offdep}
             \\
        \midrule
        GDP & -0.0452* &     -0.00709** &  -0.790*    \\
        roe  &  0.0908***  & 3.961*  & 0.296*  \\
        dbacba      &       -0.0924***& -0.00684* & -0.346*** \\
        dbagdp      &     0.121***&  -0.0191***  &  2.223***   \\
        cbagdp         &       -0.104***   & -0.0112** & \\
        fdgdp        &      0.170***   & 0.0139***  &  \\
        stmktcap     &      -0.0313***  & -0.000374*** & \\
        listco\_pc &    -0.000903***   & 0.0000722*** & \\
        llgdp         &      -0.239***     &      -0.125** &       -1.968***\\
        overhead         &   0.669***                 &       &   \\
        cbagdp         &                   -0.342***&        &   \\
        infltn         &        0.0269**   &       &   \\
        stvaltraded        &      0.175***          &        &   \\
        bcbd         &         -0.00621***  &     &   \\
        ll\_usd         &             -0.00000177***      &   -0.000398***  &  \\
        stmktcap         &               &    &  -0.0154**  \\
        xregcon         &               &  -0.0493*   &    \\
        fdi         &                 &  -0.375  &  \\
        roa         &           &  -5.581***  &  \\
        stturnover         &        9.844***       &  2.668***    &  80.35*** \\
        \_cons         &    -2.028          &  36.10***   &   -0.00571***  \\[2pt]
        \hline \\
        \(N\)       &         116   &          181   &         132   \\
        \(R^{2}\)   &       0.882   &       0.719  &       0.607  \\
        adj. \(R^{2}\)&       0.868  &       0.701   &       0.578   \\
        \midrule[1pt]       \\
    \end{tabular}
\end{table}
  • 1
    please extend your code snippet to complete small document beginning with \documentclass{...} and ending with \end{document}. information of your page layout (text width} is key data for help you. help us to help you! – Zarko Jan 27 '18 at 07:56
  • @Werner this is not related to mine. – Prince Mc Clone Jan 27 '18 at 08:26
  • Why not related? It seems to be the exact same question? – Johannes_B Jan 27 '18 at 10:19
  • 1
    Just guessing: I think that the true problem is that this code cannot be simply pasted into a existing article. If you edit in short time your question and explain that this is really the issue, it could be reopened and I have a detailed answer ready. Basically you need the siunitx and booktabs in the preamble, plus other changes as the table is actually ugly. – Fran Jan 27 '18 at 10:52
  • @Sebastiano: I've found what the problem is, and the O.P. is right: it isn't a problem of a too wide table, but a bad coding problem.. So I'd like to re-open the question, since I have a solution. – Bernard Jan 27 '18 at 10:57

2 Answers2

3

edit: considering egreg comments (thank you very much, egreg).

try the following (i assumed one column document):

\begin{table}[htbp]%
\caption{Summary statistics}
    \centering
\small
\sisetup{table-space-text-post={***},
         table-align-text-post=false}
% \renewcommand\arraystretch{0.8}
\begin{tabular}{@{}l
                   S[table-format=-1.8]
                   S[table-format=-2.8]
                   S[table-format=-1.5]
                @{}}
    \toprule
            &   {(1)}               &   {(2)}               &   {(3)}           \\
            &   {netinmargin}       &   {liqdtyratio}       &   {offdep}        \\
    \midrule
GDP         & -0.0452\sym{*}        & -0.00709**            & -0.790\sym{*}     \\
roe         &  0.0908\sym{***}      &  3.961\sym{*}         &  0.296\sym{*}     \\
dbacba      & -0.0924\sym{***}      & -0.00684\sym{*}       & -0.346\sym{***}   \\
dbagdp      &  0.121\sym{***}       & -0.0191\sym{***}      &  2.223\sym{***}   \\
cbagdp      & -0.104\sym{***}       & -0.0112\sym{**}       &                   \\
fdgdp       &  0.170\sym{***}       &  0.0139\sym{***}      &                   \\
stmktcap    & -0.0313\sym{***}      & -0.000374\sym{***}    &                   \\
listco\_pc  & -0.000903\sym{***}    &  0.0000722\sym{***}   &                   \\
llgdp       & -0.239\sym{***}       & -0.125\sym{**}        & -1.968\sym{***}   \\
overhead    &   0.669\sym{***}      &                       &                   \\
cbagdp      & -0.342\sym{***}       &                       &                   \\
infltn      &  0.0269\sym{**}       &                       &                   \\
stvaltraded &  0.175\sym{***}       &                       &                   \\
bcbd        & -0.00621\sym{***}     &                       &                   \\
ll\_usd     & -0.00000177\sym{***}  & -0.000398\sym{***}    &                   \\
stmktcap    &                       &                       &  -0.0154\sym{**}  \\
xregcon     &                       & -0.0493\sym{*}        &                   \\
fdi         &                       & -0.375                &                   \\
roa         &                       & -5.581\sym{***}       &                   \\
stturnover  &  9.844\sym{***}       &  2.668\sym{***}       &  80.35            \\
\_cons      & -2.028                &  36.10\sym{***}       & -0.00571\sym{***} \\
    \midrule
\(N\)       & {116}         & {181}         & {132\quad}    \\
\(R^{2}\)   & {0.882}       & {0.719}       & {0.607}       \\
adj. \(R^{2}\)
            & {0.868}       & {0.701}       & {0.578}       \\
    \bottomrule      
    \end{tabular}
\end{table}

comparison between your and table code will show you difference (number of columns, missing ampersands, formatting columns,...)

in my table testbed i obtain:

enter image description here

Zarko
  • 296,517
  • 1
    I'd not align the numbers in the last two rows, because they aren't of the same kind as those in the rows above. – egreg Jan 27 '18 at 13:56
  • @eg, you are probably right. i'm not "statistic man" and i just overtake op table. i will correct answer considering your comment. thank you very much! – Zarko Jan 27 '18 at 17:41
  • Also using \newcommand{\sym}[1]{\ensuremath{^{#1}} and \sym{*} instead of * (and so on) would make smaller asterisks (which is the usual form for statistics tables, as far as I know). – egreg Jan 27 '18 at 17:47
  • @egreg, thank you very much for short curse from statistics :-)! i had been used statistic (a lot) but in study/research of stochastic systems, where we don't use/need such tables ... – Zarko Jan 27 '18 at 18:11
0

Better late than never (I want to post this seven hours ago, but then the question was closed): Basically, you only need include also in the preamble the packages siunitx and booktabs. This produce the table, but the result however is not very nice:

mwe

The example below show also some fixes in the table as well as other minor changes to improve both the readability of the source code and the final PDF.

mww

\documentclass{article}
\usepackage{siunitx,booktabs}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar,textcomp}
\newunicodechar{·}{\textsuperscript{*}}
\begin{document}
\begin{table}[htbp]
 \caption{Summary statistics}
 \centering
 \renewcommand\arraystretch{1} % this is the default
 \begin{tabular}{@{}l*3{S[table-format=-3.10,table-align-text-post=false]}@{}}
 \toprule
                & {(1)}             & {(2)}             & {(3)} \\
 \cmidrule(l){2-2}\cmidrule(l){3-3}\cmidrule(l){4-4}
                & {netinmargin}     & {liqdtyratio}     & {offdep} \\
 \midrule
 GDP            & -0.0452·          & -0.00709··        & -0.790· \\
 roe            & 0.0908···         & 3.961$·           & 0.296·· \\
 dbacba         & -0.0924···        & -0.00684·         & -0.346··· \\
 dbagdp         & 0.121···          & -0.0191···        & 2.223··· \\
 cbagdp         & -0.104···         & -0.0112··         & \\
 fdgdp          & 0.170···          & 0.0139···         & \\
 stmktcap       & -0.0313···        & -0.000374···      & \\
 listco\_pc     & -0.000903···      & 0.0000722···      & \\
 llgdp          & -0.239···         & -0.125··          & -1.968···\\
 overhead       & 0.669···          &                   & \\
 cbagdp         & -0.342···         &                   & \\
 infltn         & 0.0269··          &                   & \\
 stvaltraded    & 0.175···          &                   & \\
 bcbd           & -0.00621···       &                   & \\
 ll\_usd        & -0.00000177···    & -0.000398···      & \\
 stmktcap       &                   &                   & -0.0154·· \\
 xregcon        &                   & -0.0493·          & \\
 fdi            &                   & -0.375            & \\
 roa            &                   & -5.581···         & \\
 stturnover     & 9.844···          & 2.668···          & 80.35··· \\
 \_cons         & -2.028            & 36.10···          & -0.00571··· \\
 \midrule
 \(N\)          & 116               & 181           & 132 \\
 \(R^{2}\)      & 0.882             & 0.719         & 0.607 \\
 adj. \(R^{2}\) & 0.868             & 0.701         & 0.578 \\
 \bottomrule
 \end{tabular}
\end{table}
\end{document}
Fran
  • 80,769