## tabstat with asdoc in Stata

Category:asdoc,Uncategorizedasdoc makes some elegant tables when used with tabstat command. There are several custom-made routines in asdoc that creates clean tables from tabstat command. asdoc fully supports the command structure and options of tabstat. And, yes asdoc allows one additional statistics, that is, t-statistics alongside the allowed statistics in tabstat. For reporting purposes, asdoc categorizes tabstat commands in two groups:

(1) stats without a grouping variable

(2) stats over a grouping variable.

## Tabstat Without-by

If statistics are less than variables, the table is transposed, i.e. statistics are shown in columns, while variables are shown in rows

### Example 49 : One variable, many stats, including t-statistics

sysuse auto, clear asdoc tabstat price , stat(min max mean sd median p1 p99 tstat) replace

### Example 50 : Many variables, one statistic

asdoc tabstat price mpg rep78 headroom trunk weight length foreign , stat( mean) replace

### Example 51 : Many variables, many statistics

asdoc tabstat price mpg rep78 headroom trunk weight length foreign , /// stat( max mean sd median p1 p99 tstat) replace

## Tabstat with-by

### Example 52 :

bysort foreign: asdoc tabstat price mpg rep78 headroom trunk weight length, stat(mean) replace

OR

asdoc tabstat price mpg rep78 headroom trunk weight length, /// stat(mean) by(foreign) replace

### Example 53 : By with many variables and many statistics

bysort foreign: asdoc tabstat price mpg rep78 headroom trunk weight length, /// stat(mean sd p1 p99 tstat) replace