Announcement

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

  • Labels on categorical variables lost when using esttab

    Hi Statalisters.

    I am trying to incorporate key results from 5 model runs into a summary table using esttab. While all the values carry over well, all the variable names (most of which apply to categorical variables) fall off (although they exist in the standard Stata output). Also the information for each model run does not fit nicely into distinct columns. Here's my code:

    reg rel ib0.i.mat, noconstant
    estimates store S1

    reg rel ib0.i.mat ib0.i.age, noconstant
    estimates store S2

    reg rel ib0.i.mat ib0.i.age i.gen i.inc, noconstant
    estimates store S3

    reg rel ib0.i.mat ib0.i.age i.gen i.inc ib0.i.ed, noconstant
    estimates store S4

    reg rel ib0.i.mat ib0.i.age i.gen i.inc ib0.i.ed ib0.i.rel, noconstant
    estimates store S5

    esttab S1 S2 S3 S4 S5

    I would really appreciate any assistance with this.

  • #2
    You might be talking about variable labels? If so, try
    Code:
    esttab S1 S2 S3 S4 S5, label
    If not, please provide some of the output from both the standard Stata output and esttab ouput. It's not too clear what you mean otherwise.

    Comment


    • #3
      Thank you Jorrit Jorrit Gosens. Yes I was talking about labels, in particular the labels for each category of the categorical variables, although present in the Stata output, go missing when I used the esttab function.

      esttab S1 S2 S3 S4 S5 using example.rtf, replace

      However, when I add 'label, I can no longer include the comma for ", replace" at the end so not sure what to do.
      esttab S1 S2 S3 S4 S5, label using example.rtf, replace

      Output in Stata (from one model run) is fine: e.g.
      rel Coef. Std. Err. t P>t [95% Conf. Interval]
      mat
      0 0 (empty)
      [1] Legally married 2.562041 .5971999 4.29 0.000 1.391522 3.73256
      [2] De-facto 1.818552 .5979393 3.04 0.002 .6465839 2.99052
      [3] Separated 2.24221 .6019256 3.73 0.000 1.062428 3.421991
      [4] Divorced 2.31885 .5992658 3.87 0.000 1.144281 3.493418
      [5] Widowed 2.912958 .5980694 4.87 0.000 1.740735 4.085181
      [6] Single 2.232077 .5974326 3.74 0.000 1.061102 3.403052

      Output using esttab (combining the results of the 5 model runs) drops the category labels: e.g.

      ----------------------------------------------------------------------------------------------------
      (1) (2) (3) (4) (5)
      rel rel rel rel rel
      ----------------------------------------------------------------------------------------------------
      0bn.mat . . . . .
      . . . . .

      1.mat 3.938*** 4.918*** 4.605*** 5.096*** 2.562***
      (182.67) (94.61) (86.32) (7.05) (4.29)

      2.mat 2.050*** 3.288*** 3.009*** 3.522*** 1.819**
      (50.64) (47.83) (43.31) (4.87) (3.04)

      3.mat 3.582*** 4.615*** 4.212*** 4.727*** 2.242***
      (38.81) (44.09) (40.23) (6.49) (3.73)

      4.mat 3.760*** 4.665*** 4.202*** 4.718*** 2.319***
      (61.23) (60.27) (53.42) (6.51) (3.87)

      5.mat 5.255*** 5.525*** 4.878*** 5.423*** 2.913***
      (77.37) (79.17) (66.63) (7.50) (4.87)

      6.mat 2.856*** 4.123*** 3.821*** 4.319*** 2.232***
      (90.77) (59.33) (54.85) (5.97) (3.74)


      I want to be able to combine the results of a number of model runs to present in a nice table that can be exported in .rtf format for use in Word. I appreciate any help.


      Comment


      • #4
        All your options go after the comma, and using file before it. It would never be two commas, always all the options as a list after a singe comma
        Code:
        esttab S1 S2 S3 S4 S5 using example.rtf, label replace

        Comment


        • #5
          Thanks Jorrit Jorrit Gosens but even including 'label' in my code as you suggested did not solve the problem of the program dropping the actual labels of the individual categories within a variable and replacing them with the variable name, as I showed in my esttab example above.

          Do you have any other ideas?

          Comment


          • #6
            You want the name of the variable to be listed just above all your categories, is that it?
            This is a bit more tricky, but you an look at: https://www.statalist.org/forums/for...ut-from-estout

            Comment

            Working...
            X