Hi everyone,

this seems like a super obvious question that I'm sure somebody has asked before, but for the life of me, I can't find exactly what I'm looking for. In essence, what I am trying to do is simply export a table in which the cells are the means of a variable for a cross-tab of two other variables. Taking the auto dataset for a super simple example:

Code:
sysuse auto, clear
tab rep78 foreign, sum(mpg) means
*ignore the missing values
I would like to export that table to either excel or latex. I have tried using user written commands such as esttab (which wouldn't let me use the "sum" option), asdoc (which gave me the frequencies in the cells instead of the mean value), and tab2xl (which got me closest but also had the standard deviation in each cell which I don't want [the option of "tab, sum() means" was disabled]).

Any help that anyone here could provide would be highly appreciated!
Thanks so much,
John