Announcement

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

  • How to remove unnecessary coefficient of DID

    Hello. I am running DID and outreg2.
    But when I check the result table in excel sheet, I dont wanna se the unnecessary coeffiencets' results like ;
    0b.dadedu_somecol#0b.post 0.000 0.000
    (0.000) (0.000)
    0b.dadedu_somecol#1o.post 0.000 0.000
    (0.000) (0.000)
    1o.dadedu_somecol#0b.post 0.000 0.000
    (0.000) (0.000)

    How can I remove only them in outreg2 line.....
    I really appreciate if anyone helps me....

    I added drop in the outreg2 lines. but nothing works well....

    Thank you


    %-------------------------------------------

    global var dadedu_somecol dadedu_col dadeducol_age14region_noncapital

    foreach fit in lin quad {
    foreach sx in all male female {
    foreach var in $var {
    foreach i of numlist 10 15 {

    * (1) i.age14region
    reg edu_somecol `var'##post ${`fit'} $ctrl1 if inrange(cbirthyr,-`i',`i') ${`sx'} & age>=30 & age <60, vce (cluster cl_group)
    estadd ysumm, mean

    if "`var'"=="dadedu_somecol" & `i'==10 {
    local how replace
    }
    else {
    local how append
    }

    est save ${rslt}/collapse/bandwidth`i'/`var'_c1_`fit', replace //1 all 2 male 3 female
    outreg2 using ${tab}/collapse/`sx'_`fit', `how' dta dec(3) adjr2 ///
    cttop("band`i'") adds("Dep. var. mean", e(ymean), "Adjusted R-squared", e(r2_a)) adec(3) ///
    drop(0.*`var'##0.*post)

    * (2) i.age14region age age_sq
    reg edu_somecol `var'##post ${`fit'} $ctrl2 if inrange(cbirthyr,-`i',`i') ${`sx'} & age>=30 & age <60, vce (cluster cl_group)
    estadd ysumm, mean

    est save ${rslt}/collapse/bandwidth`i'/`var'_c2_`fit', replace //1 all 2 male 3 female
    outreg2 using ${tab}/collapse/`sx'_`fit', append dta dec(3) adjr2 ///
    cttop("band`i'") adds("Dep. var. mean", e(ymean), "Adjusted R-squared", e(r2_a)) adec(3) ///
    drop(0.*`var'#0.*post)
    }

    }
    }
    }

  • #2
    It seems the coefficients you want to drop are named as "0?.dadedu....", but you are trying to drop something named as "0.dadeau...."
    You might try "drop(0?.*`var'#0?.*post)

    Comment


    • #3
      I changed using this one, but it doesnt work....

      drop(0b.`var'#0b.post 0b.`var'#1o.post 1o.`var'#0b.post)

      Comment


      • #4
        outreg2 is from SSC (FAQ Advice #12). What I said in 2023 here — https://www.statalist.org/forums/for...utreg2-command — still holds today. I'll just add a note to that thread to show a simpler way to select the interactions to keep using fvexpand.

        Comment

        Working...
        X