asdocx: Export from Stata to Word, Excel, LaTeX & HTML › Forums › asdocx Forum › flexmat summary statistics in a loop | asdocx | Stata › Reply To: flexmat summary statistics in a loop | asdocx | Stata
You need to add the variable name in the loop, try this:
loc NextRow 2 flexmat reset flexmat addrow, data (Variable, Obs, Mean, Std.Dev., Max, Min) row(1) foreach var in twear tnonwear move comm mon oth { sum nrobot_`var' flexmat addrow, data (`var', `r(N)',`r(mean)', `r(sd)',`r(max)', `r(min)') row(`NextRow') dec(3) loc ++NextRow } asdocx export