Announcement

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

  • exporting reghdfe tables

    Hi Statalist, I have a question. Presumably Sergio Correia will be the best one to answer it, but perhaps there is something very fundamental that I am missing. I am using STATA 17.

    I am using reghdfe together with the esttab/estout commands to export regression tables to rtf format. I have closely followed the example provided here.

    Basically, while the provided solution allows to include the absorbed fixed effects in the esttab command, as soon as I want to export the table these FE indication disappear. Just retyping Sergio's example and adding one line to export the table:

    Code:
    sysuse auto
    
    * Run and store regressions
    reghdfe price weight length, a(turn) keepsing
    estimates store model1
    reghdfe price weight length, a(turn trunk) keepsing
    estimates store model2
    reghdfe price weight length, a(turn foreign) keepsing
    estimates store model2
    
    * Prepare estimates for -estout-
        estfe . model*, labels(turn "Turn FE" turn#trunk "Turn-Trunk FE")
        return list
    
    * Run estout/esttab
        esttab . model* , indicate("Length Controls=length" `r(indicate_fe)') replace  // shows the absorbed FE as well as the "Length Controls" indication
        esttab . model* using "mypath/test.rtf", indicate("Length Controls=length" `r(indicate_fe)') replace // does not show the absorbed FE, only the "Length Controls" indication; replace 'mypath' with the path to save the rtf file
    
            
    * Return stored estimates to their previous state
        estfe . model*, restore
    Perhaps I am missing more fundamental about STATA? Thank you for helping me out.

  • #2
    try,
    Code:
    * Setup
    sysuse auto
    
    * Run and store regressions
    reghdfe price weight length, a(turn) keepsing
    estimates store model1
    reghdfe price weight length, a(turn trunk) keepsing
    estimates store model2
    reghdfe price weight length, a(turn foreign) keepsing
    estimates store model2
    
    * Prepare estimates for -estout-
        estfe . model*, labels(turn "Turn FE" turn#trunk "Turn-Trunk FE")
        return list
    
    * Run estout/esttab
        esttab . model* using test.rtf, indicate("Length Controls=length" `r(indicate_fe)') replace
            
    * Return stored estimates to their previous state
        estfe . model*, restore

    Comment


    • #3
      Thank you, that did the trick!

      To be quite honest, I am not sure why the local `indicate_fe' cannot be called again after one esttab, but the provided solution works for me for now.

      Comment

      Working...
      X