Epi Info™ User Guide

Command Reference


Analysis Commands: TABLES

Description
This command cross-tabulates specified variables in two or three dimensions. Values of the first variable appear across the top of the table while those of the second variable appear in the left margin of the table. Unique values of additional variables are represented as strata. Normally, cells contain counts of records matching the values in the corresponding marginal labels. If a WEIGHTVAR parameter is given, the cells represent sums of the weight variable. TABLES DISEASE COUNTY WEIGHTVAR=COUNT provide the same results as SUMTABLES COUNT DISEASE COUNTY in Epi6.

Syntax
TABLES <exposure> <outcome> {STRATAVAR=[<variable(s)>]} {WEIGHTVAR=<variable>} {PSUVAR=<variable>} {OUTTABLE=<table>}

  • <exposure> represents the variable in the database to be considered the risk factor (or * for all variables).
  • <outcome> represents the variable in the database considered disease of consequence (or * for all variables).
  • <variable> represents the variable in the database.
  • <table> represents a valid table name to be used to store output.

Comments
For every possible combination of values of the strata variables, a separate table (stratum) for variable 1 by variable 2 is produced. TABLES BAKEDHAM ILL STRATAVAR=SEX produces a table of BAKEDHAM by ILL for each value of sex-one for M and one for F. TABLES BAKEDHAM ILL STRATAVAR=SEX RACE produces a separate table of BAKEDHAM by ILL for each combination of SEX and RACE-female/black, female/white, male/black, male/white, etc.

If * is given instead of a variable name, each variable in the dataset is substituted for * in turn. To analyze each variable by illness status, use the command TABLES * ILL which produces tables of SEX by ILL, AGE by ILL, etc.

It is important to consider using * or requesting multidimensional tables if the dataset is large (thousands of records), since it may produce more tables than needed in terms of time, paper, and other costs. Press Ctrl-Break to exit from a lengthy procedure.

For 2×2 tables, the command produces odds and risk ratios. For these values to have their accepted epidemiological meanings, the value representing presence of the exposure and outcome conditions must appear in the first row and column of the table. Epi Info yes/no variables are automatically sorted properly. The STATISTICS setting controls the detail to which the statistics are reported. For tables other than 2×2, Chi-square statistics are computed. If an expected value is < 5, the message Chi-square not valid appears. The mid-p and Fisher exact are preferred, especially in this case.

Multiline (memo) variables cannot be used in tables. To use a Multiline variable, define a new variable and assign to it the value SUBSTRING(<old variable>,1,255) and use it in the table.

Examples
Example 1: A 2×2 table is generated showing coronary heart disease (CHD) by Catecholamine Level (CAT).

READ {.\Projects\Sample\Sample.prj}:EvansCounty 
TABLES CAT CHD

Example 2: A 2×2 table is generated showing coronary heart disease (CHD) by Catecholamine Level (CAT), stratified by an age group variable of type yes/no.

READ {.\Projects\Sample\Sample.prj}:EvansCounty 
TABLES CAT CHD STRATAVAR=AgeG1

Example 3: A 2×2 table is generated for every variable in the database using Ill as the outcome variable for table.

READ {.\Projects\Sample\Sample.prj}:Oswego 
TABLES * Ill

Example 4: A 2×2 table is generated and saved to a separate table in the Sample database using the OUTTABLE parameter.

READ {.\Projects\Sample\Sample.prj}:Oswego 
TABLES Vanilla Ill OUTTABLE = T1 
READ {.\Projects\Sample\Sample.prj}:T1 
LIST * GRIDTABLE

Example 5: A 2×2 table is generated showing obesity and disease outcome. The analysis is weighted by the value contained in the COUNT column.  Note: Since “COUNT” is a reserved word, it must have square brackets around it.

READ {.\Projects\Sample\Sample.prj}:Lasum 
TABLES OB OUTCOME WEIGHTVAR=[COUNT]

Example 6: A complex sample table is generated using a stratified cluster survey.

READ {.\Projects\Sample\Sample.prj}:Epi10 
TABLES Prenatal VAC STRATAVAR=Location WEIGHTVAR=POPW PSUVAR=Cluster
Page last reviewed: September 16, 2022, 12:00 pm