next up previous
Next: Graphs in Stata Up: No Title Previous: Saving data

Summarising data

The table command gives well-designed multiway tables

table alcohol case
table tobacco case
table alcohol tobacco case

Means and other summary statistics are available from summarize.

summarize age alcohol tobacco
sort case
by case: summarize age alchohol tobacco
The summaries are not very meaningful for these categorical variables, but they indicate how to use the commands. The by option is available for many Stata commands; it only works if the corresponding sort command has been given earlier. You are not expected to understand this command but you may find it useful.

There is also a nice set of epidemiological table commands for Mantel-Haenszel analysis. First we will generate binary versions of the exposure variables

generate binalc=alcohol>2
generate bintob=tobacco>2
Now we can do various Mantel-Haenszel analyses using the cc (case-control) command:
cc case binalc
cc case binalc ,by(age)
cc case bintob
cc case bintob ,by(age)



Thomas Lumley
Wed Jan 22 09:16:46 PST 1997