Announcement

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

  • How to use esttab to display the independent variables under other name?

    I have a multi regressions as below and using esttab at the end to produce a publication-style report

    Code:
    reghdfe y x1 , a(firm year)
    est sto m1
    
    
    reghdfe y x1 x2 x3 , a(firm year)
    est sto m2
    
    reghdfe y x1 x2 x3 x4 , a(firm year)
    est sto m3
    
    esttab m1 m2 m3 m4 m5 using "directory\report.csv",star(* 0.1 ** 0.05 *** 0.01) ar2  title(" **y** ") mtitle("1" "2" "3" ) keep(x1 x2 x3 x4)
    So, it will display the x1, x2 ,x3, x4 in the result table

    However, instead of displaying x1, x2,x3, x4, I want to display them under other names called xx1, xx2, xx3,xxxx4 what I should do?

    I read the esttab guide but cannot find the way out.
    Last edited by Phuc Nguyen; 02 Aug 2021, 22:22.

  • #2
    Hi Phuc. I find it easy to change the variable names directly in the report produced by esttab.

    Comment


    • #3
      Chris Boulis
      Do you mean we open the excel or CSV file and then edit manually?

      Comment


      • #4
        Yes Phuc that is what I mean. I haven't saved to a .csv file before, I usually save to .rtf files then edit my variables as it is often the case that the names we give them in our code will not be clear to others. Good luck.

        Comment


        • #5
          See also the label option described in the output of help esttab in the section on Labelling, and the output of help label to learn how to assign labels to variables.

          Comment


          • #6
            Apart from labeling the variables and using the -label- option, you can change the names directly using the -coeflabel()- option. This is documented under -help esttab- as pointed out by William.

            Code:
            sysuse auto, clear
            reg mpg weight turn
            esttab, coeflab(weight "whatever1" turn "whatever2")
            Res.:

            Code:
            . esttab, coeflab(weight "whatever1" turn "whatever2")
            
            ----------------------------
                                  (1)  
                                  mpg  
            ----------------------------
            whatever1        -0.00536***
                              (-5.31)  
            
            whatever2          -0.134  
                              (-0.75)  
            
            _cons               42.80***
                               (9.03)  
            ----------------------------
            N                      74  
            ----------------------------
            t statistics in parentheses
            * p<0.05, ** p<0.01, *** p<0.001
            Last edited by Andrew Musau; 03 Aug 2021, 06:23.

            Comment

            Working...
            X