Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72830

"replace" and "append" in foreach loop

$
0
0
Hi,
I'm using esttab (http://repec.org/bocode/e/estout/index.html) with a foreach loop. If I put the esttab outside the loop I get completely horizontal output

foreach type in TERM_ANY TERM_I TERM_V misconduct {
eststo: reg `type' var1 var2 var3
}
esttab using "${output}table.csv", star(* 0.10 ** 0.05 *** .01) b(4) r2 ar2 pr2 replace

But I want to stack so each element of the foreach gets its own rows.


foreach type in TERM_ANY TERM_I TERM_V misconduct {
eststo: reg `type' var1 var2 var3
esttab using "${output}table.csv", star(* 0.10 ** 0.05 *** .01) b(4) r2 ar2 pr2 append
}


But then this appends everything to the old version of "table". Is there any way to clear the old version before starting the loop?

Thanks!

Viewing all articles
Browse latest Browse all 72830

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>