Doctors Revision

SPSS for Biostatistics and Health Data Analysis

Text size
On this page 21 sections

Overview

Clinical Medicine Year 2 • Biostatistics and research

SPSS for biostatistics is a practical way to organise health data, describe patterns and carry out statistical analyses. IBM SPSS Statistics offers a graphical interface as well as command syntax, but software cannot repair a weak research question, poor sampling, inconsistent measurements or incorrect coding. A defensible workflow starts with the protocol and data dictionary, preserves the raw data, checks every transformation, selects procedures that match the design and variables, and interprets output with clinical and public-health context.

Learning outcomes

After this lesson, you should be able to describe the main SPSS windows; create a clear variable structure; import, clean and document a health dataset; summarise categorical and numerical variables; select suitable basic tests; interpret tables, confidence intervals and p-values cautiously; and save syntax and outputs so another analyst can follow the work.

1. What SPSS can and cannot do

SPSS can store rectangular datasets, recode or calculate variables, produce tables and graphs, and run a wide range of statistical procedures. In a typical health project, a participant or record is one row and each measured variable is one column. SPSS can help answer questions such as “What proportion of participants reported a medicine stock-out?” or “How does the mean value differ between two independent groups?”

It does not decide whether the sample represents the target population, whether an exposure preceded an outcome, whether consent was valid, or whether a causal claim is justified. Those decisions depend on the research protocol, data provenance and subject knowledge. Menu names and available procedures can differ by SPSS version, edition and licensed modules; always check the software documentation available to your institution.

2. Prepare a project before opening the dataset

Create a project folder with clearly named subfolders for protocol, raw data, cleaned data, syntax, output and reports. Preserve an unchanged copy of source data; work on a separate, dated copy. Use a participant study ID rather than a name or telephone number, and do not import unnecessary direct identifiers. Store the linkage file separately with access restricted according to the approved data plan.

Before analysis, write a short analysis plan tied to each objective: outcome, explanatory variables, summary measure, comparison or model, possible confounders, missing-data approach and any subgroup analyses. This reduces the temptation to run many tests and report only the most interesting result.

3. Know the main SPSS windows

4. Build a data dictionary and define variables

Use short, unique variable names without spaces, but provide readable labels. Set numeric, string, date or other storage type correctly. Choose value labels for coded categories and set the measurement level with care: nominal categories have no natural order; ordinal categories do; scale variables are quantitative. In SPSS, the measurement-level setting helps some menus and charts, but it does not replace statistical judgement.

Variable Type / level Label and values Quality check
VariableType / levelLabel and valuesQuality check
study_idString or numeric identifier; nominalUnique study identification codeNo duplicates; no direct identifiers.
age_yearsNumeric; scaleAge in completed yearsCheck plausible minimum and maximum against eligibility.
sexNumeric; nominal1 = female; 2 = male; include other categories if collected and approvedConfirm coding from the source tool; do not infer missing values.
adherentNumeric; nominal1 = meets prespecified adherence definition; 0 = does notKeep the validated measure and rule documented.
stageNumeric; ordinal1 = mild; 2 = moderate; 3 = severe, if defined by protocolCategories must follow the approved clinical definition.
sbp_mmHgNumeric; scaleSystolic blood pressure, mmHgInspect device, units, repeat measurements and outliers.

Do not store multiple answers in one cell, such as “1,3,5,” when they represent separate options; use an appropriate multi-response structure. Avoid meaningful-looking codes that are not documented. Create and maintain a data dictionary that records variable definitions, units, source, allowable values, derivation and missing-value rules.

5. Missing data, coding and confidentiality

Distinguish a true measured zero from “not measured,” “not applicable,” “unknown” and “prefer not to answer.” An arbitrary code such as 99 can be treated as a genuine large value if it is not declared missing. Conversely, treating a legitimate value as missing can discard information. Document the reason and amount of missingness for each important variable; compare its pattern across relevant groups where appropriate.

Check that imported value labels and formats match the questionnaire, that dates are interpreted correctly and that decimal separators were not changed. Never overwrite source responses to make a dataset appear cleaner. If a correction is justified, preserve the original, document the change, and record who authorised it and why.

6. Import and clean data step by step

Investigate unusual values; do not delete them only because they look inconvenient. A very high blood pressure might be a transcription error, a clinically important observation or a measurement issue. Verify it using the defined correction process and document the decision.

7. Transform and compute variables safely

Transform → Compute Variable can calculate a prespecified quantity such as body mass index from weight and height, while Transform → Recode into Different Variables can create a category from a continuous measure. Keep the original variable, name the derived variable clearly and record the formula, unit, cut-off and rationale. Categorising a continuous variable loses detail and may reduce analytic power; only do so when justified by the objective or a recognised clinical definition.

Data → Select Cases can define a subset for analysis, and Data → Sort Cases can arrange records. Before merging files, confirm that identifiers are unique and that the merge key is correct. Selecting or merging incorrectly can silently duplicate or drop people, so verify record counts before and after each operation.

8. Describe the data before testing hypotheses

Question Common SPSS route Useful output Check
QuestionCommon SPSS routeUseful outputCheck
How many observations per category?Analyze → Descriptive Statistics → FrequenciesCounts, percentages, valid and missing casesDo totals and denominators match the study population?
What is the centre and spread of a quantitative variable?Analyze → Descriptive Statistics → ExploreMean, median, SD, IQR, histogram and box plotAre skewness and influential outliers present?
How are two categorical variables related?Analyze → Descriptive Statistics → CrosstabsCell counts, row/column percentages and selected testsWhich denominator answers the question?
How does the distribution vary by group?Explore or Chart BuilderGroup-specific summaries and visual comparisonsAre groups independent, paired or clustered?

For approximately symmetric continuous data, a mean with standard deviation may be useful; for skewed data, the median with interquartile range is often more informative. Report denominators and missing values clearly. A percentage without its denominator can mislead, especially when records are incomplete.

9. Choose a test from the question and design

Question / data structure Possible procedure Important qualification
Question / data structurePossible procedureImportant qualification
Compare mean outcome in two independent groupsIndependent-samples t-test; a suitable rank-based alternative may be consideredCheck independence, distributions, outliers and variance assumptions; report difference and confidence interval.
Compare the same people before and afterPaired t-test or a suitable paired rank procedureAnalyse within-person differences, not as if the groups were independent.
Compare means across 3+ independent groupsOne-way ANOVA and appropriate follow-up comparisonsPlan comparisons; check assumptions and account for multiple testing.
Assess association between categorical variablesCrosstabs with chi-square; Fisher’s exact test may be appropriate in small 2×2 tablesInspect expected counts and report percentages, effect estimates and uncertainty.
Assess monotonic association between ranked or non-normal measurementsSpearman rank correlationAssociation is not agreement and does not establish causation.
Model a continuous outcomeLinear regressionAssess functional form, residuals, independence, influential points and model assumptions.
Model a binary outcomeBinary logistic regressionReport adjusted odds ratios and confidence intervals; an odds ratio is not always a risk ratio.

This is a starting guide, not an automatic test selector. Consider randomisation, repeated measures, clustering by facility, sampling weights, sparse categories, confounding, missingness and the estimand. Complex survey, survival, multilevel or diagnostic-accuracy analyses may need specialist procedures and expertise.

10. Worked example: medicine stock-outs and missed visits

Illustrative numbers only—not study findings: suppose a teaching dataset contains 100 records in a group reporting a stock-out and 100 records in a comparison group. If 20 of the first group and 10 of the second group missed a visit during a prespecified period, the observed proportions are 20% and 10%, a crude difference of 10 percentage points. The crude risk ratio would be 2.0 if the groups and outcome were defined as stated. This is a descriptive calculation, not proof that stock-outs caused missed visits.

In SPSS, first check the two binary variables and their labels. Use Analyze → Descriptive Statistics → Crosstabs, place stock-out in rows and missed visit in columns, request counts and row percentages, and choose an appropriate association statistic. Inspect expected cell counts and the study design before deciding which test or estimate is defensible. If the data are observational, consider plausible confounders and use an appropriate model only if the protocol and sample support it. IBM documents that Crosstabs forms contingency tables and offers tests and measures for categorical data; confirm the exact options for your installed version.

11. Read output as an answer, not a verdict

For a t-test, identify the group order, mean difference, units, confidence interval, p-value and assumptions. For a crosstab, identify counts and the correct row or column denominator before reading the test. For regression, check the reference group, coefficient scale, adjusted variables, confidence interval, model fit and planned assumptions. The sign and size of an estimate matter; so do its precision and clinical relevance.

A p-value is not the probability that the null hypothesis is true, the probability that the finding occurred “by chance,” or a measure of clinical importance. A confidence interval expresses statistical uncertainty under the model and assumptions; it does not include every source of bias. Describe effect estimates and uncertainty, and avoid presenting a p-value threshold as the sole conclusion.

12. Reproducibility with syntax

Use the Paste button in analysis dialogs to send commands to the Syntax Editor. Add comments describing the study objective and coding, keep a versioned syntax file and save output after running. Syntax supports review, repetition and correction; it is especially useful when several variables require the same procedure. Check that the active dataset, filters, weights and split-file settings are intentional before interpreting results.

* Example only: replace variable names with those in the approved dictionary.
FREQUENCIES VARIABLES=sex missed_visit.
DESCRIPTIVES VARIABLES=age_years sbp_mmHg
  /STATISTICS=MEAN STDDEV MIN MAX.
CROSSTABS
  /TABLES=stockout BY missed_visit
  /STATISTICS=CHISQ RISK
  /CELLS=COUNT ROW.
T-TEST GROUPS=study_group(0 1)
  /VARIABLES=sbp_mmHg
  /CRITERIA=CI(.95).

Run commands on a copy and verify each output. Syntax does not automatically make an analysis reproducible if the dataset, filters or variable coding are undocumented.

13. Graphs for clinical and public-health data

Use bar charts for categorical counts or percentages, histograms for distribution shape, box plots for group comparisons and scatterplots for two quantitative variables. Label axes with units, identify the denominator and avoid truncated axes that exaggerate differences. Choose a graph that answers a specific question and remains readable in print or on mobile.

14. Common mistakes and practical safeguards

15. Mini case: antenatal iron supplementation

A student asks whether adherence to iron supplementation is associated with maternal haemoglobin at a later visit. Before analysing, define adherence and its measurement window, define the haemoglobin unit and timing, decide whether visits are paired or cross-sectional, inspect missing results, and consider gestational age, infection and baseline haemoglobin as possible explanatory factors. If adherence is categorised, retain the original scale where possible and justify the cut-off. A simple group comparison may describe an association but does not remove confounding or establish causality.

16. Review questions with quick answers

  1. What does one row and one column usually represent in a participant-level dataset?
  2. Why should a missing code such as 99 be documented in SPSS?
  3. Which procedure can test association between two categorical variables?
  4. When is a paired test more appropriate than an independent-samples test?
  5. What should accompany a p-value in a report?
  6. Why preserve raw data and syntax separately?

Continue the research methods sequence

Review types of health research and study designs, why research matters to the health system and how to formulate a research topic and title. Compare SPSS with STATA for biostatistics and return to the Clinical Medicine Year 2 curriculum.

References and further reading

Educational revision material only. Statistical software output is not a substitute for study design, data protection, ethical approval or qualified statistical advice for complex analyses. Do not upload identifiable patient data to unauthorised devices or services.

Further Reading

For deeper study, use official statistical-software and research-analysis resources:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top