asdoc tabstat x, by(y) stat(N mean) title (xx) save(x.doc), append
Reply To: Asdoc tabulate–showing statistics, rounding decimals
Also with tabstat the totals are shown in the return window but not in the document. Example below.