Hi all,

I'm using Stata 17 and the user-written esttab command from SSC to create/export tables to rtf. I need to use the mean command with the over suffix because I'm working with complex survey data. My issue is getting the correct format for the names of the rows. Here's an illustration using the auto data.

Code:
sysuse auto, clear
eststo: mean weight, over(foreign)
This prints a table in the display with the row names determined by the labels for foreign, i.e. "Domestic" and "Foreign". However, when I utilize the esttab command,
Code:
esttab, wide se nostar
the row names are "c.weight@0.foreign" and "c.weight@1.foreign". The question is how do I get the row names as "Domestic" and "Foreign"?

I recognize this can be done manually like so:

Code:
esttab, wide se nostar varlabels(c.weight@0.foreign "Domestic" c.weight@1.foreign "Foreign")
However, I'm dealing with a very large number of variables so need an automated solution. Thanks in advance.