Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Suppress \addlinespace in esttab/estout?

    Is there a simple way to suppress the \addlinespace between covariate rows when outputting regression results from Stata to latex using esttab/estout?

    Here is an example that results in a tex file with those spaces.

    Code:
    clear 
    mata: mata clear
    estimates clear
    eststo clear
    
    sysuse auto
    eststo: regress price weight mpg
    eststo: regress price weight mpg foreign
    
    esttab  using "/${LATEX}/Tables/TEST.tex", label style(tex)     ///
            booktabs noconstant fragment depvars replace

  • #2
    estout is from SSC, as you are asked to explain (FAQ Advice #12). Thanks for the data example. Here is some way using the -substitute()- option.

    Code:
    clear 
    mata: mata clear
    estimates clear
    eststo clear
    
    sysuse auto
    eststo: regress price weight mpg
    eststo: regress price weight mpg foreign
    
    esttab, label style(tex)  booktabs substitute ("\addlinespace" " ") ///
    noconstant fragment depvars replace

    Res.:

    Code:
    . 
    . esttab, label style(tex)  booktabs substitute ("\addlinespace" " ") ///
    > noconstant fragment depvars replace
    
                        &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}\\
                        &\multicolumn{1}{c}{Price}&\multicolumn{1}{c}{Price}\\
    \midrule
    Weight (lbs.)       &       1.747\sym{**} &       3.465\sym{***}\\
                        &      (2.72)         &      (5.49)         \\
     
    Mileage (mpg)       &      -49.51         &       21.85         \\
                        &     (-0.57)         &      (0.29)         \\
     
    Car origin          &                     &      3673.1\sym{***}\\
                        &                     &      (5.37)         \\
    \midrule
    Observations        &          74         &          74         \\

    Comment


    • #3
      WOW. Ok thanks I will check out those FAQ advice. And this is perfect, I had no idea I could do substitutions like this, thank you!

      Comment


      • #4
        -esttab, substitute()- is very powerful option, and good to know. However, for your particular problem, -esttab, nogaps- is more elegant.

        Comment

        Working...
        X