Documentation

13A.25 Frequency tables and percent denominators

Frequency tables count combinations of categorical values. --table-rows defines rows, --table-columns creates a two-way table, and --table-percent chooses none, row, column, or total percentages. One-way tables display N and percent automatically.

nlmx custom data.csv --distinct ID --table-kind frequency `
  --table-rows ARM --table-columns SEX --table-percent column `
  --table-total

The frozen ARM-by-SEX table is subject-level and includes totals. Column percentages answer “within each sex, what share is in each arm?” Row percentages would answer “within each arm, what share has each sex?” Total percentages use the complete table denominator. These are not interchangeable.

Missing categories affect denominators and may appear explicitly depending on the table construction. State whether missing values are included in totals. Small counts can create unstable percentages and disclosure risk; suppress or aggregate according to project policy outside custom when required.

--table-total and --no-table-total override defaults. Overall margins are helpful for reconciliation but can clutter high-dimensional tables. More than two conceptual dimensions are usually clearer as multiple tables or a listing.

Suppose 20 women and 10 men are distributed across three arms. Column percentages describe the arm distribution separately within women and men; row percentages describe sex composition within each arm; total percentages divide every cell by 30. Write this sentence before choosing --table-percent.

For events rather than subjects, a frequency table counts rows, not unique people with an event. Reduce or derive one row per person when the estimand is incidence. Recurrent-event counts require a different, explicitly stated grain.

Common mistakes

  • Reporting column percentages as row percentages.
  • Counting records rather than subjects.
  • Showing percentages without counts.
  • Publishing small identifiable cells.

Checklist

  • Define rows, columns, and counting grain.
  • Write the percentage denominator in the title or footnote.
  • Reconcile totals.
  • Review missing and small cells.
  • Cross-check counts against allocation data.

Further reading

See bar counts, demographics, denominators, and output formats.