CDISC with R
SDTM, ADaM and TLFs from scratch using a simulated Phase III trial
Welcome
Most CDISC courses hand you a finished SDTM domain and walk you through its columns. This one hands you the raw export instead: five files, birth dates recorded four different ways, one subject enrolled twice. You build the domain yourself, decide what to do about the duplicate, and defend the decision.
This course teaches CDISC clinical data standards by building them: you take raw data from a simulated Phase III trial (codename GLPX-1) and carry it all the way to submission-ready datasets and outputs, in R.
Every claim about a standard in this book is cited to the section of the Implementation Guide it comes from (SDTMIG v3.4, §4.4.4, ADaMIG v1.3, §3.3.8), so you can check it, and so you learn where to look when the next question arrives.
Go to Before You Begin: Setup and follow the steps there. This course pins its package versions with renv; the setup session explains why and gets you restored and rendering in a few minutes. Nothing else in the course will work until you have done this.
Who This Course Is For
- Statistical programmers and biostatisticians moving into clinical trial work in the pharmaceutical industry
- Master’s and PhD students in biostatistics, epidemiology, bioinformatics, health data science or pharmacy, who want to see how clinical trial data is actually shaped before they meet it in a job interview
- People already working in pharma with clinical data who know the standards but do the work in SAS, and want to see the same pipeline in R
- R users in clinical research who need to produce or consume CDISC-standard datasets
- Data managers and researchers preparing data for a regulatory submission who want to understand the pipeline end to end
You do not need any prior CDISC knowledge. The course assumes you have never opened an Implementation Guide.
If you are a student, the useful thing here is not the vocabulary. It is that you will have built a real SDTM domain from a messy export, decided what to do about a subject enrolled twice, and defended the decision. That is a different sentence to put in an application than “familiar with CDISC”.
This course is a hands-on build of one trial’s data, from raw export to analysis datasets and outputs, against the versions of the standards a 2024 study start would actually be held to: SDTMIG v3.4 (with SDTM v2.0), ADaMIG v1.3 (with ADaM v2.1), the OCCDS v1.1 structure for adverse events, Define-XML and Dataset-JSON.
This course is not a reference manual, a substitute for the Implementation Guides, or a survey of every domain and variable. It builds a small number of domains and datasets properly (DM, AE, LB and VS, then ADSL, ADAE and ADLB), and teaches you to read the guides for the rest.
It is also not a statistics course. The analyses here exist to give the data somewhere to go.
What This Course Expects From You
- Working R and RStudio, and comfort running code you did not write
- Basic tidyverse:
dplyrverbs, pipes, andggplot2at the level of “I can read this plot’s code” - No CDISC knowledge, and no clinical trials background beyond knowing roughly what a randomised trial is
Every code chunk is written to be copied into your console and run in the order shown, against data that ships with the repository.
How the Course Is Organised
Part 1: Foundations. Why clinical data standards exist at all, argued from a real mess in GLPX-1’s raw files rather than asserted; then the trial itself, its design, and what its data should look like if the design is respected.
Part 2: SDTM. The tabulation standard. Observation classes and controlled terminology, then building DM (identifiers, treatment dates, the study-day rule), an Events domain (AE), and Findings domains (LB and VS), including what to do with a duplicate record, a missing unit, and an implausible lab value. Closes with Define-XML.
Part 3: ADaM. The analysis standard. Why analysis datasets are not just SDTM rearranged, then ADSL (one row per subject: populations, treatment, dates), ADAE (occurrence data: treatment emergence and incidence denominators), and ADLB (basic data structure: parameters, analysis values, and the baseline every change is measured from).
Part 4: Outputs and Submission. Tables, listings and figures; generating Define-XML from a specification workbook the way a sponsor does; the Analysis Data Reviewer’s Guide; and Dataset-JSON, the standard meant to replace the transport format everything else has assumed.
All sessions are written. Every part is complete: prose written, every code chunk executed against the repository’s data, every standards claim cited to the Implementation Guide section it comes from, and every exercise built against numbers that were computed rather than assumed.
The book is still maintained in the open, so corrections and improvements land continuously.
It is also still in development in one specific sense. No cohort has run it yet. The prose has been checked against the standards and every number is executed, but nobody has taught it to twenty people and discovered which explanation collapses under a real question. That is the part that only contact with learners can fix.
Help Make It Better
If you know this material, you will find things to argue with. Please do.
- Something is wrong. A standards claim that does not match the Implementation Guide, a version reference that has moved on, an origin or a derivation that would not survive review. These are the most valuable reports of all, and citations are what settle them.
- Something is unclear. If an explanation lost you, that is a defect in the explanation. Say where you stopped following; you do not need to propose a fix.
- Something is missing. A domain, a variable, a trap you have hit in real work that the course does not mention.
- You do this for a living and we do it differently. Sponsors differ and that is fine, but if the course teaches something no sponsor would accept, that is worth knowing.
Open an issue or a pull request. For anything that is not a typo, an issue first usually saves work. See CONTRIBUTING.md for what a useful report contains.
Contributors are credited. Anyone whose issue or pull request changes the course is named in the repository’s contributor list, and substantial contributions are acknowledged by name in the session they improved. The course carries a DOI, so that credit is citable.
Questions rather than corrections belong in Discussions.
All data in this course is synthetic, generated by R/simulate_trial.R. No real patient information is used anywhere. The simulator also plants a small number of deliberate data defects: a duplicated lab record, a missing start date, a sex value that disagrees between two sources. Learning to find and resolve those is most of the job.
Exercises are included in this book. Solutions, extra exercises and instructor material are available in the paid tier.