Dear,
I have a set of different dependent variables and a common set of controls. Furthermore, I need to store my results.
I have created my global list (not reported). You can find below my loop script.
xtset classid
local i = 1
foreach var of global y_inv {
xtreg`var' $control1, fe
estimates store m`i'
local ++1
}
However, it is not enough. Now, I need to run regression for different kind of business types. Hence, in a typical regression line, it would be:
xtreg y1 x1 x2 x3 if business==1, fe
xtreg y1 x1 x2 x3 if business==2, fe
xtreg y1 x1 x2 x3 if business==3, fe
How can I add this "if business==" in my loop"? Ok I could run three different loops with the condition If but it is not efficient.
Related Posts with loop regression
How to loop through two locals instead of all variables inside each local Code: local ipv "angry fear intimacy_idx cont12_idx ev12_idx pv12_idx sv12_idx ipv_ovall_idx" lo…
Multivariate Non Linear Decomposition mvdcmpHello All I am trying to work on gender differentials and urban-rural differentials. I have used mvd…
How do we use -- e.g. loop over, or save -- all the scalar names in a command's return list without knowing the names in advance?I'd like to be able to access all of the scalar names from a command's return list without knowing w…
Problems corresponding to variable names in stata double-layer loopsI encountered a problem in the process of data merging. I put 5 control variables into 5 sheets of a…
How to loop through multiple locals instead of all variables inside each local? Code: local ipv "angry fear intimacy_idx cont12_idx ev12_idx pv12_idx sv12_idx ipv_ovall_idx" local…
Subscribe to:
Post Comments (Atom)
0 Response to loop regression
Post a Comment