Announcement

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

  • Questions regarding outreg2 and saved estimates

    Hi all,

    I am currently struggling with outeg2 and couldn't find any solution on Internet. I am replicating an economics paper (Kaur 2019), and using two different datasets to run similar regressions. The data is available here: https://www.aeaweb.org/articles?id=10.1257/aer.20141625. I would want the results of the different regressions to be displayed in the same table , using outreg2. Here is my code:

    Code:
    *************** World Bank data - Main Exhibits ***************
    clear
    use data_wb_replication.dta
    
    * Table 1
    reg lwage i.dist i.year amons80 bmons20, cluster(regionyr)
    est store WB1_1
    
    reg lwage i.dist i.year lamons80 lbmons20, cluster(regionyr)
    est store WB1_2
    
    reg lwage i.dist i.year lamons80 lbmons20 if amons80==0, cluster(regionyr)
    est store WB1_3
    
    *************** NSS data - Main Exhibits ***************
    clear
    use data_nss_replication.dta
    
    * Table 1
    reg lwage i.dist i.year amons80 bmons20 [w=mult*totdays], cluster(regionyr)
    est store NSS1_1
    
    reg lwage i.dist i.year lamons80 lbmons20 [w=mult*totdays], cluster(regionyr)
    est store NSS1_2
    
    reg lwage i.dist i.year lamons80 lbmons20 [w=mult*totdays] if amons80==0, cluster(regionyr)
    est store NSS1_3
    
    outreg2 [WB1_1 WB1_2 WB1_3 NSS1_1 NSS1_2 NSS1_3] ///
    using myfile, ///
    tex(frag) replace ///
    keep(amons80 bmons20 lamons80 lbmons20)
    It works when I generate latex tables separately, i.e. only using the data from the World Bank or only from the National Sample Survey. However, when running this code, it tells me that the _est_WB1_1 is not found. Yet, it is present when i look into my estimates directory, and it still gives me the same error message when I restore WB1_1 right before using outreg2.

    I don't understand where the error comes from.

  • #2
    outreg2 is from SSC (FAQ Advice #12). There is a requirement that the estimation sample be accessible to the command, which is not the case if you load a different dataset. You can use -append- instead.

    Code:
    *************** World Bank data - Main Exhibits ***************
    clear
    use data_wb_replication.dta
    
    * Table 1
    reg lwage i.dist i.year amons80 bmons20, cluster(regionyr)
    est store WB1_1
    
    reg lwage i.dist i.year lamons80 lbmons20, cluster(regionyr)
    est store WB1_2
    
    reg lwage i.dist i.year lamons80 lbmons20 if amons80==0, cluster(regionyr)
    est store WB1_3
    
    
    outreg2 [WB1_1 WB1_2 WB1_3] ///
    using myfile, ///
    tex(frag) replace ///
    keep(amons80 bmons20 lamons80 lbmons20)
    
    
    *************** NSS data - Main Exhibits ***************
    clear
    use data_nss_replication.dta
    
    * Table 1
    reg lwage i.dist i.year amons80 bmons20 [w=mult*totdays], cluster(regionyr)
    est store NSS1_1
    
    reg lwage i.dist i.year lamons80 lbmons20 [w=mult*totdays], cluster(regionyr)
    est store NSS1_2
    
    reg lwage i.dist i.year lamons80 lbmons20 [w=mult*totdays] if amons80==0, cluster(regionyr)
    est store NSS1_3
    
    outreg2 [NSS1_1 NSS1_2 NSS1_3] ///
    using myfile, ///
    tex(frag) append ///
    keep(amons80 bmons20 lamons80 lbmons20)

    Comment

    Working...
    X