看 table 命令
Examples
-----------------------------------------------------------------------------------------------------------------
Setup
. sysuse auto
One-way table; frequencies shown by default
. table rep78
One-way table; show count of nonmissing observations for mpg
. table rep78, contents(n mpg)
One-way table; multiple statistics on mpg requested
. table rep78, c(n mpg mean mpg sd mpg median mpg)
Add formatting
. table rep78, c(n mpg mean mpg sd mpg median mpg) format(%9.2f)
Two-way table; frequencies shown by default
. table rep78 foreign
Two-way table; show means of mpg for each cell
. table rep78 foreign, c(mean mpg)
Add formatting
. table rep78 foreign, c(mean mpg) format(%9.2f) center
. table foreign rep78, c(mean mpg) format(%9.2f) center
Add row and column totals
. table foreign rep78, c(mean mpg) format(%9.2f) center row col
-----------------------------------------------------------------------------------------------------------------
Setup
. webuse byssin
Three-way table
. table workplace smokes race [fw=pop], c(mean prob)
Add formatting
. table workplace smokes race [fw=pop], c(mean prob) format(%9.3f)
Request supercolumn totals
. table workplace smokes race [fw=pop], c(mean prob) format(%9.3f) sc
-----------------------------------------------------------------------------------------------------------------
Setup
. webuse byssin1
Four-way table
. table workplace smokes race [fw=pop], by(sex) c(mean prob) format(%9.3f)
Four-way table with supercolumn, row, and column totals
. table workplace smokes race [fw=pop], by(sex) c(mean prob) format(%9.3f) sc col row
-----------------------------------------------------------------------------------------------------------------


雷达卡


京公网安备 11010802022788号







