Announcement

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

  • Generating tables using the eststo and esttab commands in Stata and exporting the tex. file into Latex

    Hi, I am currently trying to generate a table in stata to import into Latex using the following code:

    esttab using OLS_Tables.tex, replace keep(Leverage logTotalAssets Tangibility RevenueGrowth FirmAge _cons) order(Leverage logTotalAssets Tangibility RevenueGrowth FirmAge _cons) r2 b(%9.3f) se(%9.3f)label star(* 0.10 ** 0.05 *** 0.01) nonotes addnotes("$^{\ast} \text{ } p<0.10,\text{ } ^{\ast \ast}p<0.05, \text{ } ^{\ast \ast}p<0.01$" "Robust standard errors in parentheses") compress

    It generates the following table as seen below
    Click image for larger version

Name:	Screenshot 2023-03-29 at 12.07.50 PM.png
Views:	1
Size:	97.9 KB
ID:	1707566


    How would I edit my code further to replicate the format of the following table including a title, a row below the equation number to include the type of regression (OLS) above the dependent variable (ROA), a seperate section showing Year FE?
    Click image for larger version

Name:	Screenshot 2023-03-29 at 11.56.31 AM.png
Views:	1
Size:	37.6 KB
ID:	1707567



    Thanks!
    Last edited by Anushae Meerza; 28 Mar 2023, 22:19.

  • #2
    Code:
    webuse grunfeld, clear
    eststo m1: qui reg invest mvalue kstock
    eststo m2: xtreg invest mvalue kstock i.year, fe
    esttab m1 m2, indicate("Time effects = *.year") mlab(OLS FE) collab(invest) title(My table) drop(_cons)
    Res.:

    Code:
    . esttab m1 m2, indicate("Time effects = *.year") mlab(OLS FE) collab(invest) title(My table) drop(_cons)
    
    My table
    --------------------------------------------
                          (1)             (2)   
                          OLS              FE   
                       invest          invest   
    --------------------------------------------
    mvalue              0.116***        0.118***
                      (19.80)          (8.56)   
    
    kstock              0.231***        0.358***
                       (9.05)         (15.75)   
    
    Time effects           No             Yes   
    --------------------------------------------
    N                     200             200   
    --------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    Last edited by Andrew Musau; 29 Mar 2023, 03:28.

    Comment

    Working...
    X