Part 3 · Module 1

Summarising Categorical Data

Learn how to summarise binary, nominal and ordinal medical data using transparent counts, percentages, denominators and contingency tables.

Learning outcomes

After completing this lecture, you should be able to:

  • Distinguish binary, nominal and ordinal categorical variables.
  • Calculate and interpret frequencies, proportions and percentages using explicit denominators.
  • Construct one-way and two-way frequency tables for medical data.
  • Summarise ordinal categories without treating numerical codes as measured quantities.
  • Report missing values, sparse categories and confidence intervals for important proportions.

Overview

Categorical variables place observations into groups. Examples include sex recorded for a study, smoking status, blood group, disease stage, treatment allocation and whether a clinical outcome occurred.

The first task is usually descriptive: show how many observations belong to each category and what proportion of the relevant denominator they represent. This appears straightforward, but misleading summaries arise when denominators are hidden, missing values are excluded silently, ordinal categories are treated as equally spaced numbers or percentages are calculated in the wrong direction.

This lecture explains how to summarise binary, nominal and ordinal categorical data using one-way frequency tables, contingency tables and confidence intervals for important proportions. Formal comparisons between categorical variables are developed in Part VI.

Why this matters

Consider the statement:

Sixty-five per cent of patients achieved blood-pressure control.

The statement cannot be interpreted fully without knowing:

  • the number of patients represented;
  • whether the denominator includes everyone enrolled or only those measured;
  • how blood-pressure control was defined;
  • the assessment time;
  • whether missing outcomes differed by clinic or treatment group; and
  • whether the percentage was observed or model-based.

A result of 65% could mean 13 of 20, 65 of 100 or 650 of 1,000. The numerical percentage is the same, but its precision and clinical context are not.

Categorical-data summaries should therefore present counts and percentages together, define the denominator and preserve the meaning and ordering of categories [1], [2].

Types of categorical variables

Binary variables

A binary variable has two categories.

Examples include:

  • blood-pressure controlled: yes or no;
  • current smoker: yes or no;
  • adverse event: present or absent; and
  • intervention group: treatment or control.

Binary variables are commonly summarised by the number and proportion in one category, with the other category implied only when there are no missing or additional states. Reporting both categories is often clearer.

Nominal variables

A nominal variable has categories without a natural order.

Examples include:

  • blood group;
  • clinic site;
  • ethnicity categories defined for a study;
  • type of antihypertensive medicine; and
  • smoking status recorded as never, former or current.

Codes such as 1, 2 and 3 are category labels. Their arithmetic mean has no clinical interpretation.

Ordinal variables

An ordinal variable has categories with a meaningful order, but the spacing between adjacent categories is not established as equal.

The adherence rating may be:

  1. very poor;
  2. poor;
  3. good; and
  4. very good.

The order is meaningful. However, the difference between very poor and poor need not equal the difference between good and very good.

Ordinal categories should be displayed in their clinical order rather than alphabetically.

Frequency, proportion and percentage

A frequency is the number of observations in a category.

A proportion is the frequency divided by a denominator that contains the numerator.

In the survey, 310 of 480 participants with known status have controlled blood pressure:

p^=310480=0.6458\hat{p}=\frac{310}{480}=0.6458

Therefore, the observed percentage is 64.6%.

The proportion does not include the 20 participants with missing control status in its denominator. Those missing outcomes must be reported separately.

One-way frequency tables

A one-way frequency table shows the distribution of one categorical variable.

Simulated categorical summaries

simulated data

Table 1. Smoking status among 500 participants

Smoking statusNumberPercentage
Never smoked28056.0%
Former smoker14529.0%
Current smoker7014.0%
Missing51.0%
Total500100.0%

Note: Percentages use all 500 participants as the denominator.

Table 2. Blood-pressure control status

Control statusNumberPercentage among known outcomes
Controlled31064.6%
Not controlled17035.4%
Known outcome480100.0%
Missing outcome204.0% of all participants

Note: The control percentages use 480 participants with observed status. Missingness uses all 500 participants.

The two tables use different denominator conventions, but each states them explicitly.

Should missing be shown as a category?

Missing information is usually not a genuine clinical category. It should be reported, but it should not be combined with categories such as never, former and current smoking unless the analysis specifically treats missingness as a separate state.

A useful presentation often shows:

  • percentages among observed values; and
  • the number and percentage missing using the eligible sample as denominator.

Contingency tables

A contingency table, also called a cross-tabulation, shows the joint distribution of two categorical variables.

The direction of percentages must match the question.

Suppose the question is:

Within each clinic location, what percentage had controlled blood pressure?

The denominator should be the number with known outcome in each location. These are column percentages if locations are columns.

Table 3. Blood-pressure control by clinic location

Control statusUrban (n = 320)Rural (n = 160)Total (n = 480)
Controlled218 (68.1%)92 (57.5%)310 (64.6%)
Not controlled102 (31.9%)68 (42.5%)170 (35.4%)
Total320 (100.0%)160 (100.0%)480 (100.0%)

Note: Percentages are calculated within clinic-location columns. Twenty participants with missing control status are excluded from this table and reported separately.

This table describes a cross-sectional association. It does not establish that clinic location caused the difference.

Row, column and total percentages

For the same counts:

  • row percentages answer how the location distribution differs within each outcome category;
  • column percentages answer how the outcome distribution differs within each location;
  • total percentages describe each cell as a proportion of the whole table.

Do not display every percentage simultaneously unless the table remains interpretable.

Summarising ordinal categories

Ordinal data should retain their ordering.

Table 4. Self-reported medication adherence

Adherence ratingNumberPercentage
Very poor255.2%
Poor8016.7%
Good24551.0%
Very good13027.1%
Observed480100.0%
Missing204.0% of all participants

Note: Percentages for ratings use 480 observed responses.

The full distribution is usually more informative than one summary category.

Possible concise summaries include:

  • percentage reporting good or very good adherence: 375/480 (78.1%);
  • median category when clinically meaningful; and
  • cumulative percentages across ordered categories.

Collapsing categories changes the variable and may hide important patterns. Any grouping rule should be clinically justified and preferably prespecified.

Mode and category diversity

The mode is the most frequent category. In Table 4, good adherence is the modal category.

The mode alone is rarely sufficient because it hides the rest of the distribution. Two populations may have the same mode but very different proportions in other categories.

Measures of category diversity exist, but they are not usually necessary for introductory medical reporting unless they answer a specific research question.

Confidence interval for a proportion

A sample percentage estimates a population proportion when the sampling design supports that inference. A 95% confidence interval expresses sampling uncertainty under the method and assumptions.

For 310 controlled outcomes among 480 participants, the Wilson score interval is 60.2% to 68.7% [3].

Survey weights and clustered categorical data MMed extension

Simple percentages treat every observation as contributing equally.

In a probability survey with unequal selection probabilities, weights may be required. If participants are sampled within clinics or communities, observations within the same cluster may be correlated. The point estimate and confidence interval should then reflect weights, strata and clusters.

An unweighted x/n percentage may describe the sample accurately but fail to estimate the target population proportion.

Suggested reporting

Observational reporting should identify the study population, denominators, missing data and relevant sampling methods in accordance with design-specific guidance such as STROBE [4].

Common mistakes

Knowledge check

Why should 64.6% be reported as 310/480 (64.6%)?

Answer and reasoning

The count and denominator reveal how the percentage was constructed, show the amount of information and make missing observations visible. A percentage alone cannot provide this context.

Smoking status is coded 0 = never, 1 = former and 2 = current. Should the mean code be reported?

Answer and reasoning

No. The codes are labels for nominal categories without meaningful numerical spacing. Frequencies and percentages should be reported.

What denominator should be used to report control within rural clinics?

Answer and reasoning

Use the number of rural participants with known control status. In the simulated table, this is 160, so the result is 92/160 (57.5%).

Should missing adherence responses be combined with 'very poor adherence'?

Answer and reasoning

No. Missingness does not establish poor adherence. Combining them misclassifies participants and changes the clinical meaning. Missing responses should be reported separately.

What does the 95% confidence interval for a sample proportion not address?

Answer and reasoning

It does not automatically address selection bias, measurement error, nonresponse bias or poor population coverage. It describes sampling uncertainty under the chosen interval method and design assumptions.

Key take-home messages

References

  1. Agresti A. An introduction to categorical data analysis. 3rd ed. Hoboken (NJ): Wiley; 2018.
  2. Altman DG. Practical statistics for medical research. London: Chapman and Hall; 1991.
  3. Wilson EB. Probable inference, the law of succession, and statistical inference. J Am Stat Assoc. 1927;22(158):209–212. https://doi.org/10.1080/01621459.1927.10502953
  4. von Elm E, Altman DG, Egger M, Pocock SJ, Gøtzsche PC, Vandenbroucke JP, et al. The Strengthening the Reporting of Observational Studies in Epidemiology (STROBE) statement: guidelines for reporting observational studies. PLoS Med. 2007;4(10):e296. https://doi.org/10.1371/journal.pmed.0040296

These notes support learning and research planning and do not replace statistical consultation for a specific study.

Report an error in this lecture