Home Forums ASDOC : Easy Publication Quality Tables in Stata asdoc in a loop with nest option in Stata Reply To: asdoc in a loop with nest option in Stata

Attaullah Shah
Keymaster
Post count: 69

Juan Miranda: The question you have asked on StackOverflow is on hold, so I cannot add my answer there. The loop you are using does not use asdoc on each data set that you have. So the correct code would be:

cd "F:\datasets"
local i : dir "F:\datasets" files "*.dta"
foreach file in `i' {
use `file', clear
asdoc reg y x1 x2 x3, append nest rep(t) title(Table 1 MCO per year) dec(3) save(reg)
}

Please also note that there should be no space between rep and (t | se). The same applies to other options of asdoc.
Also note: the option rep(t) is used to report t-statistics. Instead, if you want to report standard errors, you would use rep(se). However, you cannot use both rep(t|se). Perhaps, you copied this from the help file of asdoc, where the symbol pipe is used to denote that one of these can be used.