Hi,
I am trying to create a table (example attached) using esttab command. I have run different specifications of the regression and also stored the estimates with different names but I don't know how to ensure that esttab uses the stored estimates I want. Additionally, the table has to be generated for 5 specifications of the variable and hence I have used a foreach loop. This is my Stata code:
use "${home}/pointonepctsampleE.dta"
gen logminwage =ln(minwage)
g post = year==2006
xi i.division*post, pre(_d)
global X "division i.sex age i.racesingd married i.citizen hieduc"
foreach j of numlist 50 75 100 125 150 {
cap drop underp`j'
g underp`j' = poverty<`j'
//Specification 1
qui areg underp`j' logminwage post , cluster(state) absorb(state)
eststo DID
//Specification 2
qui areg underp`j' logminwage $X post , cluster(state) absorb(state)
eststo DIDwithcontrols
//Specification 3
qui areg underp`j' logminwage _d* post , cluster(state) absorb(state)
eststo divisionspecific
//Specification 4
qui areg underp`j' logminwage $X _d* post , cluster(state) absorb(state)
eststo divisionspecificandcontrols
if `j'==50{
esttab using table1.tex, replace keep(logminwage _cons) label nodep nonotes se noeqlines noobs mtitles(" " " " " " " ") title(Minimum Wage Difference in Difference\label{auto}) b(4)
}
if `j'==150{
esttab using table1.tex, append keep(logminwage _cons) nodep nonum nonotes se noeqlines mlabels(none) collabels(none) label b(4)
}
else {
esttab using table1.tex, append keep(logminwage _cons) nodep nonum nonotes se noeqlines noobs mlabels(none) collabels(none) label b(4)
}
}
I am copying the compiled table that I am getting and the kind of table that I require (also attached). It seems the way I am using esttab with the foreach loop is erroneous - the table repeats values for poverty<50 and is also all over the place on the page. I am new to Stata and any help would be greatly appreciated.
Related Posts with Using esttab to create a table
Test for homoscedasticity (hettest)Hi guys I would like to perform the Breusch-Pagan test for homoscedasticity. My question is what is…
Excluding certain observations from a scatterplotHello all, I'd like to drop the observations for "time" > -20 but < -5 and also for time >…
Filling in missing values in long dataset using other non-missing valuesHello, I have a long dataset that includes data on events. Each individual experiences many interva…
Calculating mean value to percentage of recommendationHello I am quite new to stata. I have searched answer, but I haven´t found right one yet. I have d…
How do I save scalars in a loop to a variable?Hello everyone! I'd like to save two scalars generated in a loop to a variable. My current code rea…
Subscribe to:
Post Comments (Atom)
0 Response to Using esttab to create a table
Post a Comment