Data Preparation, Analysis Guidelines, and Documentation – STAT, Handout 01 – Study Notes

Source: Handout 01, Principles of Statistics I (Texas A&M University) | Textbook: Ott & Longnecker, 7th Ed.

Tags: data preparation, raw data source, machine-readable database, editing data, data quality, logic checks, original files, work files, preliminary analysis, primary analysis, backup analysis, statistical report, documentation, data trail


TL;DR

Processing raw data into a form ready for analysis can consume 75% of total project effort. The six-step preparation cycle (receive, create database, edit, correct, finalise, create files) protects data quality and creates a clear data trail. Analysis itself splits into preliminary, primary, and backup stages, and results must be documented thoroughly enough that someone else could reconstruct the entire analysis.


Key Terms

Raw data source

The original form in which data arrive: case report forms, laboratory notebooks, thumb drives, hand tabulations, or other electronic records.

Machine-readable database

The data file created by entering data from the raw source into a computer system, complete with column numbers, variable names, and codes for missing values.

Coding guide

A document that assigns column numbers, variable names, missing-value codes, and brief descriptions to each variable in the database.

Logic checks

Validation rules based on the structure of the data. For example, Visit 2 data cannot have an earlier date than Visit 1; a patient lost to follow-up after Visit 2 cannot have Visit 3 data.

Original files

Data files that reflect the basic structure of the machine-readable database, checked against the database listing for correct formats and retained missing-value codes.

Work files

Data files derived from original files, restructured or augmented (new variables created by computation or transformation) to facilitate analysis.

Preliminary analysis

Descriptive or graphic analyses that familiarise the statistician with the data: frequency distributions, histograms, box plots, descriptive statistics, correlations, bivariate plots.

Primary analysis

The analyses that directly address the study's objectives and on which conclusions are drawn.

Backup analysis

Alternative methods that confirm or complement the primary analysis, sometimes including newer statistical methods.

Data trail

The documented chain from raw data through database creation, editing, correction, analysis, and final report, allowing anyone to reconstruct what was done.


Core Content

The Six Steps of Data Preparation

Data preparation is not glamorous, but it accounts for roughly three quarters of the work between receiving raw data and presenting results.

Step 1: Receive the raw data source. Retain the original records. They are the start of the data trail. Log the following: date received and from whom, study investigator, team members, brief study description, treatments studied, raw data source format, response variables measured, reference number, and estimated completion date.

Step 2: Create the database. If data are on paper, check for legibility and bring problems to the study coordinator. Fill out a coding guide. Enter data into a machine-readable database. Print a listing and check it against the raw source. Correct errors and verify against an updated listing. If data arrive already in machine-readable form, use the coding guide to verify that formats and values look reasonable.

Step 3: Edit the database. Examine the minimum, maximum, and frequency distribution of each variable to catch unreasonable values. Plot the data (scatter plots, box plots) and look for anomalies. Run logic checks appropriate to the data structure.

Step 4: Correct and clarify the raw data source. Questions about legibility or accuracy can arise at any stage. Keep a list of problems and discrepancies. If a correction is needed, mark it on the original form and update the database to match. If no correction is needed, note that too.

Step 5: Finalise the database. Data do not always arrive all at once (e.g., a marketing survey covering different regions over time). Each batch must go through the create-edit-correct cycle. Once all data are in, review the full database and make final corrections before analysis begins. Agreeing on a final database avoids having to re-run all analyses later.

Step 6: Create data files from the database. Produce original files that mirror the database structure and verify them against the database listing. If needed, create work files that restructure, select, or transform variables for analysis. Check work files against original files and verify derived variables by hand calculation.

Analysis Guidelines

Preliminary analyses build your understanding of the data. They include frequency distributions, histograms, box plots, descriptive statistics, comparability checks across treatment groups, correlations, and univariate or bivariate plots.

Primary analyses address the study's core objectives. Conclusions are drawn from these.

Backup analyses use alternative methods to confirm primary results, or apply newer techniques.

Best practices for all three:

  • Use well-tested statistical software

  • Label output clearly: which study, which subjects, which analysis

  • Use variable labels and value labels (e.g., 0 = none, 1 = mild, 2 = severe)

  • Provide a data listing for each analysis

  • Check output carefully: verify sample sizes, means, degrees of freedom, error logs

  • Save all analyses that inform conclusions

Outline for a Statistical Report

A formal written report typically follows this structure:

  • Summary

  • Introduction

  • Experimental design and study procedures

  • Descriptive statistics

  • Statistical methodology used in analysis

  • Results and conclusions

  • Discussion

  • Data listings (usually in an appendix)

Documentation and Storage

The goal of documentation is a clear, complete data and analysis trail. If an unfamiliar colleague who is knowledgeable in the field can reconstruct and redo your primary analyses using your documentation, you have done the job.

A general documentation and storage file includes:

  • Statistical report

  • Study description

  • Random code used to assign subjects to treatment groups

  • Important correspondence

  • File creation information

  • Preliminary, primary, and backup analyses

  • Raw data source

  • Data management sheet (the log plus information on data file storage)

The Bottom Line on Data Quality

Even if the statistical methods are perfectly appropriate, conclusions are only as good as the data they rest on. The effort invested in preparation depends on the study's nature, the quality of the raw source, and how confident you need to be in completeness and accuracy.


Why It Matters / Exam Flags

⚠️ Data preparation consumes roughly 75% of effort. This is a commonly cited figure.

⚠️ Know the six steps of data preparation in order.

⚠️ Understand the difference between original files and work files.

⚠️ Know the three types of analysis (preliminary, primary, backup) and what each one does.

⚠️ Logic checks are a practical exam topic: be able to give examples of impossible data patterns (e.g., Visit 2 before Visit 1).

⚠️ "Conclusions are only as good as the data" is a recurring theme across the course.


Practice Q&A

Q: Approximately what percentage of total project effort does data preparation typically consume?

A: About 75%.

Q: What is the purpose of a coding guide?

A: It assigns column numbers, variable names, missing-value codes, and brief descriptions to each variable in the database, allowing anyone to "read" and interpret the data file.

Q: Give an example of a logic check you might perform on patient visit data.

A: Verify that the date for Visit 2 is not earlier than the date for Visit 1. If a patient was lost to follow-up after Visit 2, confirm there is no data recorded for later visits.

Q: What is the difference between a primary analysis and a backup analysis?

A: A primary analysis directly addresses the study's objectives and is the basis for conclusions. A backup analysis uses alternative methods to confirm or complement the primary results.

Q: Why is it important to finalise the database before beginning analysis on a large dataset?

A: Because analysis and summarisation of large datasets require considerable staff and computing time. Re-running everything on a changed database is costly, so agreeing on a final version first avoids duplication.

Q: What is the standard for judging whether documentation is complete enough?

A: Ask a colleague unfamiliar with the project but knowledgeable in the field to reconstruct and redo the primary analyses. If they can navigate the documentation trail, it is adequate.


Related Terms / Search Tags

data preparation, raw data source, machine-readable database, coding guide, data entry, data editing, logic checks, data quality, data validation, original files, work files, data transformation, preliminary analysis, primary analysis, backup analysis, descriptive statistics, frequency distribution, histogram, box plot, statistical report outline, documentation, data trail, SAS data sets, proc print, proc contents, data management