I would like to run the following regression command on different subsamples of a dataset. The different samples are indicated with binary variables named sample1, sample2, etc. which take the value 1 if the observation is part of the respective subsample.
How would you amend the command below so that it re-runs on sample2, sample3 etc. (up to sample10) and exports each regression output in the Excel file?
Thanks a lot in advance for your help!
Code:
* list independent variables local scores score1 score2 score3 score4 score5 * list control variables local controls i.industry i.year foreach IV of varlist `scores' { probit success `scores' i.moderator##c.`IV' `controls', cluster(id), if sample1>0 outreg2 using "regression.xls", /// append excel dec(3) /// addstat(Pseudo R-squared, `e(r2_p)') }
0 Response to Re-run regression command on different subsamples
Post a Comment