I have A as a dependent variable, B as an independent variable, and a list of control variables including dummy variables (var1 var2 var3 i.var4 i.var5...).
So what I want to do is to create a loop for multiple regression and then store each resulting estimate with labels like reg1, reg2, and so on.
I looked up on Statalist and found a way to do the first part,
Code:
local predictors B var1 var2 var3 i.var4 i.var5 local regressors foreach p of local predictors { local regressors `regressors' `p' regress A `regressors' }
I tried doing something with estimates store but it didn't work..
Also could you tell me if I could use foreach using something like foreach X of varlist instead of local predictors?
Many thanks!!!
0 Response to How to create a loop for doing regression with multiple variables and storing each estimate with a sequential label
Post a Comment