Announcement

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

  • Have etable put stars in the same cell of the coefficient

    I use the following to generate the regression tables:
    Code:
    quietly etable, estimates(h_1_1 h_1_2 h_1_3 h_1_4 h_1_5 h_1_6 h_1_7 h_1_8) ///
    cstat(_r_b) cstat(_r_se, nformat(%7.2f)) ///
    mstat(N) mstat(r2_p, nformat(%7.4f)) mstat(chi2) stars(.1 "*" .05 "**" .01 "***", attach(_r_b)) ///
    showstars showstarsnote column(estimates) title("Models for hypothesis H1")
    Then

    Code:
    quietly collect export "$outdir/tables/h1.xlsx", replace
    But in the resulting Excel file, coefficients and stars are in two separate columns.

    I need them in the same column, because Word won't format them as I want to if they are in two different columns.


  • #2
    Hi, I am facing a similar issue and wondered if you figured this out back a few months ago! Thanks

    Comment


    • #3
      Dear all, I have the same issue; significance stars are created in separate columns.

      When I generate a regression table with "etable" command, it seems the default layout is as below.

      Code:
      collect layout (coleq#colname#result[_r_b _r_se] result[N r2]) (cmdset#stars) (), name(ETable)
      I assume "cmdset#stars" option creates separate columns, so I tried the following layout instead. But now it generates a separate rows.
      Code:
      collect layout (coleq#colname#result[_r_b _r_se]#stars result[N r2]) (cmdset) (), name(ETable)
      Any way to attach significant stars in a same column?

      Thank you.

      Comment


      • #4
        Showing your code/example without the data to go with it makes it difficult for us to make suggestions and show that our ideas actually work properly.

        collect stars dynamically labels results given a set of significance rules for the labels. The labels are created depending on stars style type: result or dimension. result creates new items for the stars labels and tags them with result[stars]. dimension creates new items for the stars labels and tags them with stars[label] and all other already-existing items are tagged with stars[value]. In general collect defaults to type result, but etable defaults to dimension -- this is to accommodate vertically aligning the numeric items independently/separately from the stars labels.

        Use command collect stars to change the type.

        Here is a short example, using the publicly available auto data.
        Code:
        * data and model setup
        sysuse auto
        regress mpg turn
        estimates store m1
        regress mpg turn trunk
        estimates store m2
        
        * table of estimates, showing stars
        etable, estimates(m1 m2) column(estimates) showstars
        
        * show current stars specification; notice the type is dimension and the labels are attached to _r_b
        collect query stars
        * change the type to result
        collect stars, result
        * show that the only thing that changed was the type
        collect query stars
        
        * replay table to see that the stars are now attached to the coefficients
        collect preview
        Here is the resulting table.
        Code:
        -------------------------------
                                  mpg  
        -------------------------------
        Turn circle (ft.)      -0.761**
                                (0.131)
        Trunk space (cu. ft.)   -0.316*
                                (0.134)
        Intercept              55.820**
                                (4.354)
        Number of observations       74
        -------------------------------

        Comment


        • #5
          Jeff Pitblado (StataCorp) Thank you so much once again! Next time I will come up with a data example. "Collect" command seems a bit complicated, but is really interesting that allows greater flexibility! Will take some time to go through it more thoroughly.

          Comment

          Working...
          X