Announcement

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

  • How to place significant stars infront of standard errors but still maintain the wide format

    Hi,
    I'm trying to get an esttab table that looks like table 1 attached. specifically, i want the stars placed after the standard errors which are also placed after the coefficients, all in one horizontal line. However, whenever i run the code and specify wide format, it breaks the lines into two. each. as seen in table 2.
    Here's my code, ran on state 16:

    logit Approval_of_Protest GPDpc_PPP_log i.Religiousity_2
    est store ModelA
    xtmelogit Approval_of_Protest GPDpc_PPP_log i.Religiousity_2 || country:, cov(unstr)
    est store ModelB

    esttab ModelA ModelB using results.rtf, wide cells(b(fmt(3)) se(par fmt(2)star)) replace


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte Approval_of_Protest float GPDpc_PPP_log byte Religiousity_2 str48 country
     0 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  0 "Algeria"
     0 32.622215  1 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  1 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
    .b 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     1 32.622215  1 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  1 "Algeria"
     1 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  0 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  0 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
    .b 32.622215  1 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215 .a "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  1 "Algeria"
     1 32.622215  1 "Algeria"
     0 32.622215  1 "Algeria"
     1 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  1 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  1 "Algeria"
     1 32.622215  1 "Algeria"
     0 32.622215  2 "Algeria"
    .b 32.622215  1 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  1 "Algeria"
     0 32.622215  1 "Algeria"
     0 32.622215  1 "Algeria"
     1 32.622215  1 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  1 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  1 "Algeria"
     1 32.622215  2 "Algeria"
     1 32.622215  1 "Algeria"
     0 32.622215  1 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  1 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  0 "Algeria"
     1 32.622215  1 "Algeria"
    .b 32.622215 .b "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  1 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     1 32.622215  1 "Algeria"
     0 32.622215  2 "Algeria"
    .b 32.622215 .b "Algeria"
     0 32.622215  1 "Algeria"
     0 32.622215  1 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  0 "Algeria"
     0 32.622215  1 "Algeria"
    .b 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
     0 32.622215  1 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     0 32.622215  2 "Algeria"
     1 32.622215  2 "Algeria"
    end
    label values Approval_of_Protest Approval_of_Protest
    label def Approval_of_Protest 0 "No", modify
    label def Approval_of_Protest 1 "Yes", modify
    label values Religiousity_2 Religiousity_2
    label def Religiousity_2 0 "Not Religious", modify
    label def Religiousity_2 1 "Somewhat Religious", modify
    label def Religiousity_2 2 "Highly Religious", modify
    ------------------ copy up to and including the previous line ------------------
    Attached Files

  • #2
    estout is from Stata Journal, as you are asked to explain (FAQ Advice #12). The option that you are missing is -staraux- rather than defining two cells separately. Secondly, rtf format will not allow you to have a wide table, so you need to use format "doc" for MS Word. In general, if you want a multi-column table spanning 3+ columns, you need to create a latex table as long wide tables exported to MS Word will be split into multiple lines. Up to 3 columns + variable names is fine.

    Code:
    sysuse auto, clear
    local vars headroom trunk weight foreign
    eststo clear
    forval i=1/ `=wordcount("`vars'") '{
        eststo: regress mpg `=word("`vars'", 1)' - `=word("`vars'", `i')'
    }
    esttab est1 est2 est3 using myfile.doc, aux(se 2) main(b 3) staraux ///
    noobs nonumber mlabels("Model 1" "Model 2" "Model 3") ///
    collabels(none) replace onecell alignment(l) gaps
    Res.:

    Code:
    ------------------------------------------------------------
                      Model 1         Model 2         Model 3  
    ------------------------------------------------------------
    headroom     -2.830 (0.73)*** -0.350 (0.88)    0.005 (0.64)  
     
    trunk                        -0.741 (0.17)*** -0.097 (0.15)  
     
    weight                                       -0.006 (0.00)***
     
    _cons        29.768 (2.28)*** 32.537 (2.15)*** 39.684 (1.81)***
    ------------------------------------------------------------
    b coefficients; se in parentheses
    * p<0.05, ** p<0.01, *** p<0.001

    Comment


    • #3
      Thank you Andrew Musau for this. I just learned something new and it's saved me a lot of time.

      Comment

      Working...
      X