Dear Statalist,

in my analysis I have a simple regression with multiple dependent variables. The dependent variables are stored in locals and the regression command is embedded into a loop.

Now, I would like to include several sets of control variables (also stored in locals). Thereby, some sets of control variables should only be included in the regression for a specific dep var.

Please notice the following simplified example:

Code:
*define control variables
local control_general x2 x3
local control_depvar1 x4 x5

*define dependent variables
local depvar depvar1 depvar2 depvar3

*regression
eststo clear
foreach y of local depvar {
eststo `y': reg `y' x1 $control_general $control_depvar1
    estadd $control_depvar1 if `x' == depvar1
}
My problem is that STATA cannot work with the condition:
Code:
 estadd $control_depvar1 if `x' == depvar1
Does anyone knows how I can include the control set "control_depvar1" only if the dependent variable in the loop is equal to depvar1?

Thank you very much in advance!

Warm regards,
Bianca