Announcement

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

  • estadd local not working in Stata 17

    Since I started using Stata 17, I encountered a problem that I cannot seem to fix. Normally, I would use the estadd local to add notes at the end of columns in the tables, but now the command doesn’t seem to work. You can see an example of my code as well as the table output below. Do you have any suggestions on how I can used estadd in Stata 17?

    eststo clear

    eststo: reghdfe defaulted2 i.gender_num#i.marital_stat share, noabsorb
    estadd local fixedeff ="No"
    sum `e(depvar)' if e(sample)==1
    estadd scalar mean =r(mean)

    eststo: reghdfe defaulted2 i.gender_num#i.marital_stat accepted, noabsorb
    estadd local fixedeff ="No"
    sum `e(depvar)' if e(sample)==1
    estadd scalar mean =r(mean)

    eststo: reghdfe defaulted2 i.gender_num#i.marital_stat share, absorb(zone_num month_year)
    estadd local fixedeff ="Yes"
    sum `e(depvar)' if e(sample)==1
    estadd scalar mean =r(mean)

    eststo: reghdfe defaulted2 i.gender_num#i.marital_stat accepted, absorb(zone_num month_year)
    estadd local fixedeff ="Yes"
    sum `e(depvar)' if e(sample)==1
    estadd scalar mean =r(mean)

    esttab using “tab1.tex", star(* 0.10 ** 0.05 *** 0.01) ///
    coeflabels( 1.gender_num "Female" ///
    0.gender_num "Male" ///
    0.marital_stat "Single" ///
    1.marital_stat "Married" ///
    2.marital_stat "Separated" ///
    3.marital_stat "Widowed" ///
    0bn.gender_num#1bn.marital_stat "Male \times Married" ///
    0bn.gender_num#2.marital_stat "Male \times Separated" ///
    0bn.gender_num#3.marital_stat "Male \times Widowed" ///
    1.gender_num#0.marital_stat "Female \times Single" ///
    1.gender_num#1bn.marital_stat "Female \times Married" ///
    1.gender_num#2.marital_stat "Female \times Separated" ///
    1.gender_num#3.marital_stat "Female \times Widowed" ///
    share "Share granted" ///
    accepted "Granted amount requested=1") ///
    nonum nomtitle drop(_cons 0bn.gender_num#0bn.marital_stat) b(3) se(4) ///
    stats(mean fixedeff N, label("Mean dep. var" "FE" "Observations") fmt(%5.3f 1 %12.0gc))

    Click image for larger version

Name:	tab1.jpg
Views:	1
Size:	72.5 KB
ID:	1710398
    Last edited by Dani SantosCard; 19 Apr 2023, 04:58.

  • #2
    estout is from SSC (FAQ Advice #12). I am pretty sure that I have successfully used estadd in Stata 17. In any case, there is no way that your final command

    esttab using “tab1.tex", star(* 0.10 ** 0.05 *** 0.01) ///
    coeflabels( 1.gender_num "Female" ///
    .
    .
    .
    produced the displayed table, as a single estimate results in only one column in the table. Come up with a small reproducible example that replicates your issue. See the aforementioned FAQ Advice for details.

    Comment


    • #3
      Originally posted by Andrew Musau View Post
      estout is from SSC (FAQ Advice #12). I am pretty sure that I have successfully used estadd in Stata 17. In any case, there is no way that your final command



      produced the displayed table, as a single estimate results in only one column in the table. Come up with a small reproducible example that replicates your issue. See the aforementioned FAQ Advice for details.
      Andrew Musau, thank you for your feedback! I created a small reproducible example that replicates my issue. Here is the code and the output table:



      set seed 345
      set obs 100
      gen defaulted2=rbinomial(1,0.095)
      gen gender_num=rbinomial(1,0.5)
      gen share=rnormal(0.8,0.15)
      gen zone_num=runiformint(1,5)


      eststo clear

      eststo: reghdfe defaulted2 i.gender_num share, noabsorb
      estadd local fixedeff ="No"
      qui: sum `e(depvar)' if e(sample)==1
      estadd scalar mean =r(mean)

      eststo: reghdfe defaulted2 i.gender_num share, absorb(zone_num)
      estadd local fixedeff ="Yes"
      qui: sum `e(depvar)' if e(sample)==1
      estadd scalar mean =r(mean)


      esttab using "tab_ex.tex", star(* 0.10 ** 0.05 *** 0.01) lines replace ///
      coeflabels( 1.gender_num "Female" share "Share granted") ///
      nonum nomtitle drop(_cons 0bn.gender_num) b(3) se(4) ///
      stats(mean fixedeff N, label("Mean dep. var" "FE" "Observations") fmt(%5.3f 1 %12.0gc))


      Click image for larger version

Name:	tabex.jpg
Views:	1
Size:	55.8 KB
ID:	1710440

      Comment


      • #4
        I cannot replicate your issue, so I suggest that you update estout and try again.

        Code:
        ssc install estout, replace
        Code:
        clear
        set seed 345
        set obs 100
        gen defaulted2=rbinomial(1,0.095)
        gen gender_num=rbinomial(1,0.5)
        gen share=rnormal(0.8,0.15)
        gen zone_num=runiformint(1,5)
        
        
        eststo clear
        
        eststo: reghdfe defaulted2 i.gender_num share, noabsorb
        estadd local fixedeff ="No"
        qui: sum `e(depvar)' if e(sample)==1
        estadd scalar mean =r(mean)
        
        eststo: reghdfe defaulted2 i.gender_num share, absorb(zone_num)
        estadd local fixedeff ="Yes"
        qui: sum `e(depvar)' if e(sample)==1
        estadd scalar mean =r(mean)
        
        
        esttab, star(* 0.10 ** 0.05 *** 0.01) lines replace ///
        coeflabels( 1.gender_num "Female" share "Share granted") ///
        nonum nomtitle drop(_cons 0.gender_num) b(3) se(4) ///
        stats(mean fixedeff N, label("Mean dep. var" "FE" "Observations") fmt(%5.3f 1 %12.0gc))
        Res.:

        Code:
        . esttab, star(* 0.10 ** 0.05 *** 0.01) lines replace ///
        > coeflabels( 1.gender_num "Female" share "Share granted") ///
        > nonum nomtitle drop(_cons 0.gender_num) b(3) se(4) ///
        > stats(mean fixedeff N, label("Mean dep. var" "FE" "Observations") fmt(%5.3f 1 %12.0gc))
        
        --------------------------------------------
        --------------------------------------------
        Female             -0.035          -0.041  
                         (0.0522)        (0.0530)  
        
        Share gran~d        0.068           0.093  
                         (0.1618)        (0.1693)  
        --------------------------------------------
        Mean .. var         0.070           0.070  
        FE                     No             Yes  
        Observations          100             100  
        --------------------------------------------
        Standard errors in parentheses
        * p<0.10, ** p<0.05, *** p<0.01


        Last edited by Andrew Musau; 19 Apr 2023, 08:41.

        Comment

        Working...
        X