benjann / estout

Stata module to make regression tables
http://repec.sowi.unibe.ch/stata/estout/index.html
MIT License
71 stars 18 forks source link

Bug in -indicate- when same estimate is used twice #18

Closed simonheb closed 5 years ago

simonheb commented 5 years ago

If the same estimate is shown in two separate columns, using the -indicate- option, only one column of indicators is generated.

eststo first: reg y x1
eststo second:  reg y x1 x2
estout first second , indicate(vars=x*)

(correctly) produces

 ------------------------------------
               (1)             (2)            
                y               y          
 ------------------------------------
vars            Yes             Yes                    
 ------------------------------------
N               2967           2967           
 ------------------------------------

but estout first second second , indicate(vars=x*) produces

 ------------------------------------------------------------
               (1)             (2)             (3)   
                y               y               y   
 ------------------------------------------------------------
vars            Yes             Yes                   
 ------------------------------------------------------------
N               2967           2967         2967
 ------------------------------------------------------------

With a missing "Yes" in the third column

(I'm using Stata 15 with and estout *! version 3.21 19aug2016)

benjann commented 5 years ago

Thanks for reporting this. indicate() got completely confused on repeated models. Early versions of estout did not allow repeated models and I missed to adjust the code behind indicate() when I introduced this functionality.

I now fixed this. Here's an example:

. sysuse auto
(1978 Automobile Data)

. qui eststo first:  reg price mpg trunk

. qui eststo second: reg price mpg trunk turn

. estout first second, indicate(tvars = t*)

--------------------------------------
                    first       second
                        b            b
--------------------------------------
mpg             -220.1649    -245.8136
_cons            10254.95     12959.56
tvars                 Yes          Yes
--------------------------------------

. estout first second second, indicate(tvars = t*)

---------------------------------------------------
                    first       second       second
                        b            b            b
---------------------------------------------------
mpg             -220.1649    -245.8136    -245.8136
_cons            10254.95     12959.56     12959.56
tvars                 Yes          Yes          Yes
---------------------------------------------------

The fix will be in the next SSC update.