Announcement

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

  • Exporting Stata Regression Results to Latex

    Hi Everyone,

    I am using tex (online version) to present my work. I would like to export my stata-results to tex. In fact, I used to export the tables to excel using the code mentioned below. How do I do the same thing, but to get the code for tex.

    This is the code I am using for the excel-export and the created table is pasted below:

    Code:
    #delimit;
    xi: areg MW PACE i.year, absorb(county) vce(cluster county);
    outreg2 using Table1_EN_counties_20190402.xls, replace excel
    addnote("Standard Errors are clustered at the County Level")
    title ("Regression Results - All Counties")
    addtext(County Dummies, `"Yes"',  Time Dummies /*date*/, `"Yes"', Covariates, `"No"',  County-specific-trends, `"No"', SE Clustered at, `"County"')
    nocons
    keep(PACE)
    dec(3)
    label;
    
    
    #delimit;
    xi: areg MW PACE i.year Grad Bach No_Deg High_Sch Pop Age Unemp Dem Rep  
     Electricity income Rebates,
    absorb(county) vce(cluster county);
    outreg2 using Table1_EN_counties_20190402.xls, append excel
    addnote("Standard Errors are clustered at the County Level")
    title ("Regression Results - All Counties")
    addtext(County Dummies, `"Yes"',  Time Dummies /*date*/, `"Yes"', Covariates, `"Yes"',  County-specific-trends, `"No"', SE Clustered at, `"County"')
    nocons
    keep(PACE)
    dec(3)
    label;
    
    The table in excel looks like this: 
    Regression Results - All Counties
    (1) (2)
    VARIABLES MW MW
    PACE 2.309* 1.269
    (1.238) (1.125)
    Observations 561 561
    R-squared 0.692 0.806
    County Dummies Yes Yes
    Time Dummies Yes Yes
    Covariates No Yes
    County-specific-trends No No
    SE Clustered at County County
    Robust standard errors in parentheses
    *** p<0.01, ** p<0.05, * p<0.1
    Standard Errors are clustered at the County Level


    I tried to use this code but it did not work.

    Code:
    #delimit;
    xi: areg MW PACE i.year, absorb(county) vce(cluster county);
    esttab using example.tex, label nostar replace booktabs
    addnote("Standard Errors are clustered at the County Level")
    title ("Regression Results - All Counties")
    nocons
    keep(PACE)
    addtext(County Dummies, `"Yes"',  Time Dummies /*date*/, `"Yes"', Covariates, `"No"',  County-specific-trends, `"No"', SE Clustered at, `"County"')
    dec(3)
    label;
    
    #delimit;
    xi: areg MW PACE i.year Grad Bach No_Deg High_Sch Pop Age Unemp Dem Rep  
     Electricity income Rebates,
    absorb(county) vce(cluster county);
    esttab using example.tex, label nostar append booktabs
    addnote("Standard Errors are clustered at the County Level")
    title ("Regression Results - All Counties")
    addtext(County Dummies, `"Yes"',  Time Dummies /*date*/, `"Yes"', Covariates, `"Yes"',  County-specific-trends, `"No"', SE Clustered at, `"County"')
    nocons
    keep(PACE)
    dec(3)
    label;
    Thank you,
    Ali

  • #2
    If you are happy with the formatting of your Excel tables, then a quicker option is to use excel2latex (https://ctan.org/tex-archive/support/excel2latex) to convert your tables in latex.

    Comment


    • #3
      Thank you!

      Comment

      Working...
      X