Hello everyone,
Currently I have this set of codes, I'm running the same regression for different levels of xxx (now I divide it into 4 levels). I don't know how to write them using a loop, because if I want to divide xxx into say 10 levels, it would be cumbersome to repeat listing out the regression 10 times. So I would like a loop to make it easier. How can I achieve this?
Thanks a lot for any suggestions
Currently I have this set of codes, I'm running the same regression for different levels of xxx (now I divide it into 4 levels). I don't know how to write them using a loop, because if I want to divide xxx into say 10 levels, it would be cumbersome to repeat listing out the regression 10 times. So I would like a loop to make it easier. How can I achieve this?
Code:
egen quantiles_xxx = xtile(xxx), by(year industry) nq(4) probit y x1 x2 x3 x4 i.industry i.year if quantiles_xxx == 1 ,vce(cluster symbol) est store model_1 probit y x1 x2 x3 x4 i.industry i.year if quantiles_xxx == 2 ,vce(cluster symbol) est store model_2 probit y x1 x2 x3 x4 i.industry i.year if quantiles_xxx == 3 ,vce(cluster symbol) est store model_3 probit y x1 x2 x3 x4 i.industry i.year if quantiles_xxx == 4 ,vce(cluster symbol) est store model_4 logout, save(abcd) word replace fix(5): /// esttab model_1 model_2 model_3 model_4, /// b(%6.3f) z(%6.3f) /// star(* 0.1 ** 0.05 *** 0.01) /// scalar(N r2_p) compress nogap

Comment