Epi Info™ User Guide

Command Reference


Analysis Commands: Summarize

Description
This command creates a new table containing summary statistics for the current dataset or its strata.

Syntax
SUMMARIZE varname::aggregate(variable) [varname::aggregate(variable) …] TO tablename STRATAVAR=variable list {WEIGHTVAR=variable}

  • Available aggregates are COUNT, MIN, MAX, SUM, FIRST, LAST, AVG, VARiance and STandardDEViation (Sum, Avg, Var and StDev available only for numeric fields). COUNT may be used without a variable in parenthesis to indicate that a count of the number of records in the table or strata is desired. You can also use COUNT with a variable in parenthesis to indicate that the number of records in the table or strata with non-missing values of the specified group is desired. FIRST and LAST are based on the current sort order.

Comments
Classic Analysis creates a new table or appends to an existing table (tablename) containing variables (varname) which represent aggregates of variables in the current data source (aggregate[variable]). The aggregates are computed for each group of records, determined by the STRATAVARs, which are also included in the table. Available aggregates are COUNT, MIN, MAX, SUM, AVG, VARiance and STandardDEViation (Sum, Avg, Var and StDev available only for numeric fields). COUNT may be used without a variable in parenthesis to indicate that a count of the number of records in the group is desired, or with a variable in parenthesis to indicate that the number of records in the group with non-missing values of the specified group is desired.

This command solves some recurring problems for programmers. One is computing percents; it is difficult to get a denominator. Another is determining the earliest or latest date in a list of relevant dates, or the highest or lowest of a series of measurements. Many problems can be solved with the OUTTABLE from a TABLES or FREQ command, or with self-joins, but this provides a straightforward method to achieve these results.

Note: Multi-line (memo) fields are not permitted.

Example

READ  {.\Projects\Sample\Sample.prj}:EvansCounty  
SUMMARIZE  Average_Age :: Avg(AGE) Average_DBP :: Avg(DBP) Number_Records :: Count(AGE) Std_Age :: StDev(AGE) Std_DBP :: StDev(DBP) TO SUMMARY_TABLE 
READ  {.\Projects\Sample\Sample.prj}:Summary_Table 
LIST *

Page last reviewed: September 16, 2022, 12:00 pm