Announcement

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

  • Create Table with 3 different independent variables

    Hello everyone,

    I am running a regression for 3 different y variables. I have 5 regressions, where in each regression I add more control variables. I want to create a table where I have 5 columns (each one for each combination of control variables) and 3 rows (each one for the impact of the xvariable on each y variable with the controls in the columns). Is this possible? The code I have at the moment is as follows:

    forvalues i=1/3{
    if `i'==1 local sub="A"
    if `i'==2 local sub="B"
    if `i'==3 local sub="C"


    eststo eq1: xtreg yvariable`sub' xvariable i.year, fe cluster(country)
    estadd local FE "YES"
    estadd local econ_control "NO"
    estadd local demo_control "NO"
    estadd local educ_control "NO"
    estadd local sector_control "NO"

    eststo eq2: xtreg yvariable`sub' xvariable control1 control2 i.year, fe cluster(country)
    estadd local FE "YES"
    estadd local econ_control "YES"
    estadd local demo_control "NO"
    estadd local educ_control "NO"
    estadd local sector_control "NO"

    eststo eq3: xtreg yvariable`sub' xvariable control1 control2 control3 control4 i.year, fe cluster(country)
    estadd local FE "YES"
    estadd local econ_control "YES"
    estadd local demo_control "YES"
    estadd local educ_control "NO"
    estadd local sector_control "NO"

    eststo eq4: xtreg yvariable`sub' xvariable control1 control2 control3 control4 control5 control6 i.year, fe cluster(country)
    estadd local FE "YES"
    estadd local econ_control "YES"
    estadd local demo_control "YES"
    estadd local educ_control "YES"
    estadd local sector_control "NO"

    eststo eq5: xtreg yvariable`sub' xvariable control1 control2 control3 control4 control5 control6 control7 control8 i.year, fe cluster(country)
    estadd local FE "YES"
    estadd local econ_control "YES"
    estadd local demo_control "YES"
    estadd local educ_control "YES"
    estadd local sector_control "YES"


    estpost eq1 eq2 eq3 eq4 eq5 using didtrial2.tex by(yvariable`sub'), keep(xvariable)

    estpost clear
    }

    Thank you very much in advance!

    Joan
Working...
X