Announcement

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

  • Make a summarize table with results of regressions

    Hello everyone! I want to replicate the table below with the results I have obtained from the loop of regressions that I show in the code. As you can see I have changed the labels in order to have the same variable names in the table. Anyone has an idea which commands I should use to store the results and show something as much similar as possible to the table below?
    Click image for larger version

Name:	Captura de Pantalla 2022-10-31 a la(s) 22.04.55.png
Views:	1
Size:	68.6 KB
ID:	1687532




    Code:
    label variable ActualT "YouWinImpact"
    label variable OwnEmp "Employed"
    label variable TotEmp10 "10+Employees"
    label variable TotEmp25 "25+Employees"
    
    
    foreach name in "InnovIndex" "OwnEmp" "TotEmp10" "TotEmp25"{
                reg `name' ActualT Strata if exist==0 & (type==1|type==2), vce(robust)
    }

    Thanks a lot.

    Luciana
    Last edited by Luciana Pando; 31 Oct 2022, 15:32.

  • #2
    Code:
    ssc install estout
    h esttab

    is one option. If you can provide a sample of your data using dataex, someone may be able to provide code that replicates the table.

    Comment


    • #3
      Hi Andrew,

      Thanks for your answer. These is the list of variables that I'am using to run the previous loop and to generate the mentioned table. Do you have any idea of how to do it? Many thanks.

      Code:
      ActualT OwnEmp TotEmp10 TotEmp25 Strata type exist
      0 1 0 0 22 1 1
      1 1 1 0  9 1 0
      1 1 0 0  4 1 1
      1 1 0 0  5 1 0
      1 1 0 0  1 1 0
      1 1 . .  9 1 0
      1 1 0 0 13 1 0
      1 1 0 0  1 1 0
      1 1 0 0  2 1 1
      1 . . .  7 1 0
      1 . . .  4 1 1
      1 1 1 0  9 1 0
      1 1 1 0 22 1 1
      1 1 0 0  9 1 0
      1 1 1 0 10 1 1
      1 1 0 0 21 1 0
      1 1 0 0 24 1 1
      1 1 1 0  5 1 0
      1 1 1 0  2 1 1
      1 1 0 0  9 1 0
      1 . . .  9 1 0
      1 1 0 0 17 1 0
      1 1 1 0  5 1 0
      1 1 1 0  5 1 0
      1 1 1 0  5 1 0
      1 1 0 0 14 1 1
      1 1 0 0  9 1 0
      1 1 0 0 17 1 0
      1 1 1 1 15 1 0
      1 1 0 0  5 1 0
      1 1 0 0 10 1 1
      1 1 0 0 11 1 0
      1 1 0 0 22 1 1
      1 1 0 0 22 1 1
      1 1 1 0  5 1 0
      1 1 1 0 23 1 0
      0 1 0 0  5 1 0
      1 1 1 0  5 1 0
      1 . . . 17 1 0
      1 1 1 0  5 1 0
      1 1 0 0 21 1 0
      1 1 1 0 24 1 1
      1 1 0 0 17 1 0
      1 1 0 0  2 1 1
      0 . . . 15 1 0
      1 1 0 0 18 1 1
      1 1 0 0  1 1 0
      1 . . .  3 1 0
      1 1 0 0 14 1 1
      1 1 0 0  1 1 0
      1 1 1 0 18 1 1
      1 . . . 20 1 1
      1 1 1 0  9 1 0
      1 1 0 0 22 1 1
      1 1 1 0 22 1 1
      1 1 1 0 17 1 0
      1 1 1 0 22 1 1
      1 1 1 0 15 1 0
      1 1 1 0  5 1 0
      1 1 0 0  6 1 1
      1 1 0 0  7 1 0
      1 0 0 0 11 1 0
      1 1 0 0 18 1 1
      1 1 0 0  9 1 0
      1 1 0 0 18 1 1
      1 . . .  2 1 1
      1 1 0 0 11 1 0
      1 1 0 0 22 1 1
      1 1 0 0 10 1 1
      1 1 1 0 10 1 1
      1 1 0 0  1 1 0
      1 1 1 0 13 1 0
      1 . . . 12 1 1
      1 1 1 1 18 1 1
      1 1 1 0  2 1 1
      1 1 0 0  7 1 0
      1 1 0 0 22 1 1
      1 1 0 0 22 1 1
      1 . . .  9 1 0
      1 1 1 0  5 1 0
      1 . . . 11 1 0
      1 1 0 0 13 1 0
      1 1 0 0 19 1 0
      1 0 0 0 24 1 1
      1 1 0 0 17 1 0
      1 1 0 0 17 1 0
      1 1 0 0 13 1 0
      1 1 1 0  5 1 0
      1 1 0 0 10 1 1
      1 . . . 22 1 1
      1 1 1 0 17 1 0
      1 0 0 0 17 1 0
      1 1 0 0  3 1 0
      1 . . . 11 1 0
      1 1 0 0  1 1 0
      1 1 0 0  9 1 0
      1 1 1 0 17 1 0
      1 . . .  2 1 1
      1 1 0 0 16 1 1
      1 1 1 0  2 1 1
      end

      Comment


      • #4
        One of the categories is missing in your data example. You probably get better coefficients and standard errors with your full dataset, but here is a way with estout.

        First:

        Code:
        ssc install estout, replace
        Run code (in blue) in a do-file:

        Code:
        clear
        input float(ActualT OwnEmp TotEmp10 TotEmp25 Strata type exist)
        0 1 0 0 22 1 1
        1 1 1 0  9 1 0
        1 1 0 0  4 1 1
        1 1 0 0  5 1 0
        1 1 0 0  1 1 0
        1 1 . .  9 1 0
        1 1 0 0 13 1 0
        1 1 0 0  1 1 0
        1 1 0 0  2 1 1
        1 . . .  7 1 0
        1 . . .  4 1 1
        1 1 1 0  9 1 0
        1 1 1 0 22 1 1
        1 1 0 0  9 1 0
        1 1 1 0 10 1 1
        1 1 0 0 21 1 0
        1 1 0 0 24 1 1
        1 1 1 0  5 1 0
        1 1 1 0  2 1 1
        1 1 0 0  9 1 0
        1 . . .  9 1 0
        1 1 0 0 17 1 0
        1 1 1 0  5 1 0
        1 1 1 0  5 1 0
        1 1 1 0  5 1 0
        1 1 0 0 14 1 1
        1 1 0 0  9 1 0
        1 1 0 0 17 1 0
        1 1 1 1 15 1 0
        1 1 0 0  5 1 0
        1 1 0 0 10 1 1
        1 1 0 0 11 1 0
        1 1 0 0 22 1 1
        1 1 0 0 22 1 1
        1 1 1 0  5 1 0
        1 1 1 0 23 1 0
        0 1 0 0  5 1 0
        1 1 1 0  5 1 0
        1 . . . 17 1 0
        1 1 1 0  5 1 0
        1 1 0 0 21 1 0
        1 1 1 0 24 1 1
        1 1 0 0 17 1 0
        1 1 0 0  2 1 1
        0 . . . 15 1 0
        1 1 0 0 18 1 1
        1 1 0 0  1 1 0
        1 . . .  3 1 0
        1 1 0 0 14 1 1
        1 1 0 0  1 1 0
        1 1 1 0 18 1 1
        1 . . . 20 1 1
        1 1 1 0  9 1 0
        1 1 0 0 22 1 1
        1 1 1 0 22 1 1
        1 1 1 0 17 1 0
        1 1 1 0 22 1 1
        1 1 1 0 15 1 0
        1 1 1 0  5 1 0
        1 1 0 0  6 1 1
        1 1 0 0  7 1 0
        1 0 0 0 11 1 0
        1 1 0 0 18 1 1
        1 1 0 0  9 1 0
        1 1 0 0 18 1 1
        1 . . .  2 1 1
        1 1 0 0 11 1 0
        1 1 0 0 22 1 1
        1 1 0 0 10 1 1
        1 1 1 0 10 1 1
        1 1 0 0  1 1 0
        1 1 1 0 13 1 0
        1 . . . 12 1 1
        1 1 1 1 18 1 1
        1 1 1 0  2 1 1
        1 1 0 0  7 1 0
        1 1 0 0 22 1 1
        1 1 0 0 22 1 1
        1 . . .  9 1 0
        1 1 1 0  5 1 0
        1 . . . 11 1 0
        1 1 0 0 13 1 0
        1 1 0 0 19 1 0
        1 0 0 0 24 1 1
        1 1 0 0 17 1 0
        1 1 0 0 17 1 0
        1 1 0 0 13 1 0
        1 1 1 0  5 1 0
        1 1 0 0 10 1 1
        1 . . . 22 1 1
        1 1 1 0 17 1 0
        1 0 0 0 17 1 0
        1 1 0 0  3 1 0
        1 . . . 11 1 0
        1 1 0 0  1 1 0
        1 1 0 0  9 1 0
        1 1 1 0 17 1 0
        1 . . .  2 1 1
        1 1 0 0 16 1 1
        1 1 1 0  2 1 1
        end
        
        label variable ActualT "YouWinImpact"
        label variable OwnEmp "Employed"
        label variable TotEmp10 "10+Employees"
        label variable TotEmp25 "25+Employees"
        
        local i 1
        foreach name in "OwnEmp" "TotEmp10" "TotEmp25"{
                    reg `name' ActualT i.Strata if exist==0 & (type==1|type==2), vce(robust)
                    qui sum `name' if e(sample)
                    estadd local cmean = `:di %5.3f r(mean)'
                    estadd local sfe= cond( ustrregexm("`e(cmdline)'", "\bStrata\b"), "Yes", "No")
                    eststo m`i'
                    local ++i
                    
        }
        
        esttab m*, se drop(_cons *Strata) stats(cmean sfe N, label("Control Mean" "Strata FE" "Sample Size")) ///
        starlevels(* 0.10 ** 0.05 *** 0.01) note("Robust standard errors in parentheses.") nonumb
        Res.:

        Code:
        . esttab m*, se drop(_cons *Strata) stats(cmean sfe N, label("Control Mean" "Strata FE" "Sample Size")) //
        > /
        > starlevels(* 0.10 ** 0.05 *** 0.01) note("Robust standard errors in parentheses.") nonumb
        
        ------------------------------------------------------------
                           OwnEmp        TotEmp10        TotEmp25   
        ------------------------------------------------------------
        ActualT         -1.00e-17           0.833***    -8.06e-17   
                       (2.19e-08)         (0.124)             (.)   
        ------------------------------------------------------------
        Control Mean         .962            .385            .019   
        Strata FE             Yes             Yes             Yes   
        Sample Size            53              52              52   
        ------------------------------------------------------------
        Robust standard errors in parentheses.
        * p<0.10, ** p<0.05, *** p<0.01
        To get the table in a rtf file


        Code:
        esttab m* using myfile.rtf


        In a LaTeX file

        Code:
        esttab m* using myfile.tex

        Comment


        • #5
          Thanks very much for your help Andrew! It works perfectly.

          Comment

          Working...
          X