I am running a panel regression and I have to try combinations of variables.
I have been trying to run the code below:
local x0 elec_qtr_dummy
local x1 elec_qtr_dummy elec_qtr_1b
local x2 elec_qtr_dummy elec_qtr_1b elec_qtr_2b
local x3 elec_qtr_dummy elec_qtr_1b elec_qtr_2b elec_qtr_3b
local x4 elec_qtr_dummy elec_qtr_1b elec_qtr_2b elec_qtr_3b elec_qtr_4b
local x5 elec_qtr_dummy elec_qtr_1b elec_qtr_2b elec_qtr_3b elec_qtr_4b elec_qtr_1a elec_qtr_2a
local x6 elec_qtr_dummy elec_qtr_1b elec_qtr_2b elec_qtr_3b elec_qtr_4b elec_qtr_5b elec_qtr_6b
xtset companyid
forvalue v = 0/6 {
eststo,title("log_stqf_deal"): xi: xtreg log_stqf_deal `x`v'' i.year,fecluster(state_code)
est2vec table`v', e(N) vars(`x`v'') name(lstqf_deal) replace
eststo,title("log_totln"): xi: xtreg log_stqf_deal `x`v'' i.year,fe cluster(state_code)
est2vec table`v', addto(table`v') name(ltotln)
est2rowlbl `x`v'', saving replace path(`file') addto(table`v')
est2tex table`v', preserve path(`file') mark(starb)fancy levels(90 95 99) label replace
estimates clear
}
However, Stata refuses to acknowledge the presence of locals inside the forvalues loop.
It would be really helpful if somebody can point out an efficient alternative.
I'm using Stata version 12.0.
The quotes are not good. They Should be:
But I can't tell if they were good and your original formatting messed them up. You should confirm.
A working example:
You don't quote the error Stata gives you, which is a desirable thing.
You can also check the
stepwisecommand, but that is something to use wisely.