Announcement

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

  • Using esttab to create a table

    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.



    Attached Files
Working...
X