main.do
is:
foreach mode in mode1 mode2 {
do run.do
}
and run.do
is:
foreach y in y1 y2{
reg `y' x
outreg2 using `y'.xls, append ctitle(`mode')
}
It has outreg2
, so it produced a txt output. But I found that the column title is empty meaning that Stata couldn't get mode
.
That implies that the mode
loop in main.do
was not inherited by run.do
.
How can I make it inherited? It would be wonderful if I could choose whether to make it inherited.
What I tried is:
foreach mode in mode1 mode2 {
global mode `mode'
do run.do
}
and:
foreach mode in mode1 mode2 {
local mode `mode'
do run.do
}
and:
foreach mode in mode1 mode2 {
global mode "`mode'"
do run.do
}
But nothing works.