Hello,
I am currently trying to export my regressions into a table using the user-written outreg2 in Stata 17 and want to add the mean of my dependent variable to the bottom of my regression table. I've tried the two following approaches and I am not sure quite how to fix it. I am also using the user-written reghdfe to run my regressions.
The first approach:
I believe this is not working as outreg2 does not support pweights for summary statistics, although when I tried aweights my table came out without any mean statistic,
My next approach was to try and save the summary statistic from the regression command, which stores the weighted means of the statistics in e(summarize) and I try to call the relevant result using a macro.
This just ignores the e(summarize)[1,1] (which is where the statistic I want is stored) and it just reports "matrix" in the cell where I want to see the summary statistic.
I am not sure of what else to try and I do not want to have to manually input this statistic by hand into dozens of table columns.
I will be very appreciative of any help. Thank you.
I am currently trying to export my regressions into a table using the user-written outreg2 in Stata 17 and want to add the mean of my dependent variable to the bottom of my regression table. I've tried the two following approaches and I am not sure quite how to fix it. I am also using the user-written reghdfe to run my regressions.
The first approach:
Code:
reghdfe ca_inwork precovidhealth female ca_age ca_age2 ca_age3 ca_age4 precovidhours precovidhours2 precovidwantsjob precovidlooksforjob precovidnonwhite precovidarsinhwage $precovideducation if ca_age>=25&ca_age<65 [pweight=ca_betaindin_xw_t], absorb(precovidyearlastjob precovidjbstat precovideprosh precovidscsf4a precovidscsf4b precovidscsf5 precovidoccupation precovidindustry) vce(robust) outreg2 using table1, replace word dec(3) nocons keep(precovidhealth) label ctitle(Apr. 2020) stats(coef se mean)
My next approach was to try and save the summary statistic from the regression command, which stores the weighted means of the statistics in e(summarize) and I try to call the relevant result using a macro.
Code:
reghdfe ca_inwork precovidhealth female ca_age ca_age2 ca_age3 ca_age4 precovidhours precovidhours2 precovidwantsjob precovidlooksforjob precovidnonwhite precovidarsinhwage $precovideducation if ca_age>=25&ca_age<65 [pweight=ca_betaindin_xw_t], absorb(precovidyearlastjob precovidjbstat precovideprosh precovidscsf4a precovidscsf4b precovidscsf5 precovidoccupation precovidindustry) vce(robust) summarize(mean) outreg2 using table1, replace word dec(3) nocons keep(precovidhealth) label ctitle(Apr. 2020) addtext(Mean, `e(summarize)[1,1]')
I am not sure of what else to try and I do not want to have to manually input this statistic by hand into dozens of table columns.
I will be very appreciative of any help. Thank you.
Comment