Hi All!

I am currently running, let's just say 400 variations of, esttab command (from estout SSC; I use Stata 16) to make output for .tex files and I would like to automate naming the using filename.tex. For example:

Code:
est clear

eststo: reg y1 x1a x2 x3, robust
eststo: reg y1 x1a x2 x3, robust
eststo: reg y1 x1a x2 x3, robust

esttab using filename001.tex, replace

eststo: reg y1 x1b x2 x3, robust
eststo: reg y1 x1b x2 x3, robust
eststo: reg y1 x1b x2 x3, robust

esttab using filename002.tex, replace

eststo: reg y1 x1c x2 x3, robust
eststo: reg y1 x1c x2 x3, robust
eststo: reg y1 x1c x2 x3, robust

esttab using filename003.tex, replace

eststo: reg y2 x1a x2 x3, robust
eststo: reg y2 x1a x2 x3, robust
eststo: reg y2 x1a x2 x3, robust

esttab using filename004.tex, replace

eststo: reg y2 x1b x2 x3, robust
eststo: reg y2 x1b x2 x3, robust
eststo: reg y2 x1b x2 x3, robust

esttab using filename005.tex, replace

eststo: reg y2 x1c x2 x3, robust
eststo: reg y2 x1c x2 x3, robust
eststo: reg y2 x1c x2 x3, robust

esttab using filename006.tex, replace

eststo: reg y3 x1a x2 x3, robust
eststo: reg y3 x1a x2 x3, robust
eststo: reg y3 x1a x2 x3, robust

esttab using filename007.tex, replace

eststo: reg y3 x1b x2 x3, robust
eststo: reg y3 x1b x2 x3, robust
eststo: reg y3 x1b x2 x3, robust

esttab using filename008.tex, replace

eststo: reg y3 x1c x2 x3, robust
eststo: reg y3 x1c x2 x3, robust
eststo: reg y3 x1c x2 x3, robust

esttab using filename009.tex, replace
As you can see, it is an easy task when I produce a few esttab, but I'd like to find a more efficient solution that would save me from manually typing the filename over and over again for 400 (or even more) of them. I am guessing that there could be a loop sequence altogether with the eststo: reg variations here and combining a local such as:

Code:
local numlist 1/400

<loop sequence here>
1. ...
2. ...
3. ...
4. ...
5. esttab using filename`numlist'.tex, replace
but I am not very good at making loop sequence especially when each eststo: reg includes different variable variations (I am guilty for not being an efficient coder. I usually begin with one set of code variation, and then copy the whole thing and paste it repeatedly after replacing the variable names in notepad). Any help is greatly appreciated!


Best,
Nampuna