Home Forums ASDOC : Easy Publication Quality Tables in Stata asdoc: using two variables with bysort for summary statistics Reply To: asdoc: using two variables with bysort for summary statistics

Attaullah Shah
Keymaster
Post count: 69

See this example

sysuse auto, clear
bysort foreign rep78  : sum price
table foreign rep78, contents(freq mean price sd price min price min price )
asdoc table foreign rep78, contents(freq mean price sd price min price min price ) replace

------------------------------------------------------------
          |                Repair Record 1978               
 Car type |        1         2         3         4         5
----------+-------------------------------------------------
 Domestic |        2         8        27         9         2
          |  4,564.5   5,967.6   6,607.1   5,881.6   4,204.5
          | 522.5519  3579.357  3661.267  1592.019  311.8341
          |    4,195     3,667     3,291     3,829     3,984
          |    4,195     3,667     3,291     3,829     3,984
          | 
  Foreign |        .         .         3         9         9
          |        .         .   4,828.7   6,261.4   6,292.7
          |        .         .  1285.613  1896.092  2765.629
          |        .         .     3,895     3,995     3,748
          |        .         .     3,895     3,995     3,748
------------------------------------------------------------

*And using tabstat
by foreign, sort : tabstat price, statistics( count mean sd min min ) by(rep78)