Hello.
I am trying to create some doc/docx regression table output for each group of observations that has a given id number (variable name of the id number is "order"). Ideally, each table output would have as title the id or the given string variables from which the id number is generated. So far I have tried (with little success) the following code:

forval y = 1/`r(max)' {
regress y x1 x2...., vce(hc3) if order ==`i'
outreg2 using tryoutreg.doc, append ctitle(order)
}
In particular, stata does not accept the use of "if"...

Thank you. I have lost a lot of time without finding an appropriate solution, trying foreach, forval, and others.
Kind regards.