Skip to content
The study dashboard of the CDISC pilot, 254 subjects in 3 arms, with filters for the data cut and subgroups, on the page of Table 14.3.1, the primary analysis of the ADAS-Cog (11), with the protocol sentence that plans it.

From Protocol to Dashboard

You are the statistician of a real trial. An AI agent writes the SAP with you, block by block. Sapling checks every block against the protocol and the guidelines, and refuses to let the agent decide for you. At the end you have four products, made in R, each one checked.
The Sapling editor in VS Code. The statistical analysis plan of the CDISC pilot study is shown as a page: the title, the study settings, the contents. On the left the progress: decisions made, blocks with a source, findings left.
The SAP of the CDISC pilot study in the Sapling editor (VS Code). The left column counts what is left: your decisions, the blocks with a protocol source, the open findings. A screenshot of an earlier draft, from the Sapling manual.

The book ends with this line of a real run: four products, each one FINAL. Click a card for the chapter that makes it.

SAPLING FINAL: 4 of 4 FINAL (SAP FINAL, ADaM FINAL, TLFs FINAL, Dashboard FINAL)
  • 254 randomized patients, 3 arms
  • 22 open decisions, all yours
  • 84 blocks you read and agree to
  • 18,392 numbers in the ARD
  • 12 dashboard pages, each number checked

Ten steps. The steps with the amber edge are yours: an agent cannot do them, and Sapling refuses when it tries.

  1. sapling new pilot --protocol usdm.json --sdtm data/sdtma first draft of the SAP from the protocol: every block cites its sentence
  2. sapling roundthe scorecard: the agent score, and your readiness
  3. sapling agentthe agent works the loop: one block, checked in its place, measured again
  4. sapling revise · sapling agreeyou read each block in the dossier: ask for a change, or agree
  5. sapling decideyou answer what the protocol leaves open
  6. sapling build · sapling runthe specifications, the programs, the ADaM data and the tables, in R
  7. sapling blind --seed 7the programs proven on the real data with a dummy treatment
  8. sapling unblindthe real treatment back: a person’s act
  9. sapling approveyour approval, only when every block is agreed
  10. sapling final --makethe four products made again from the approved SAP, and judged

The whole path in one hour runs these steps with their real output and links each one to its chapter.

The statistician

The main reader. Each chapter explains the statistics first: estimands and intercurrent events (ICH E9(R1)), LOCF and its assumption, co-primary endpoints, the tipping-point analysis, why a dummy treatment before the unblinding. Then you make each decision yourself.

The statistical programmer

The ADaM specification, the admiral programs, the table programs, the ARD with every number, the readable R programs and the trace of a failure to its SAP block. Every program runs in R through DataStep Studio for R.

The manager

What an AI agent may do in a regulated analysis, and what it may not. Read chapter 1, the whole path, and Part IV: the dashboard and the gate that checks it.

Part What you do Chapters
Start here See the products, set up the lab, run the whole path once 1–3
I · The SAP with an AI agent A first draft, the scorecard, the agent’s loop, your additions, your judgment, your decisions 4–10
II · ADaM in R The specifications, the ADaM data in R, the check against the ADaM IG 11–13
III · Tables in R The shells, the tables and the ARD, readable R programs, a failure traced 14–17
IV · Unblinding and the dashboard A dummy treatment, the unblinding, the dashboard, the four final products 18–20
V · Practice A made-up study of type 2 diabetes from public trial results 21

Each chapter starts with what you will be able to do and how long it takes. It explains the idea, shows the commands in short terminal blocks, shows the products, and ends with an exercise and its answer.

Nothing on these pages is typed by hand. Every terminal block is the transcript of a real run on the CDISC pilot study, and every picture is taken from the products of that run. Run the same commands in the lab, and you get the same output.

Found an error or have a question? Write to datastep.studio@gmail.com· The plan is written in Sapling; every R program runs in DataStep Studio for R.

Data: the CDISC pilot study (cdiscpilot01). The protocol as CDISC USDM from the CDISC 360i project (MIT licence); the SDTM data from the PhUSE scripts repository (MIT licence). Public example data: no real patient.

R is a project of the R Foundation. SAS is a registered trademark of SAS Institute Inc. CDISC, SDTM, ADaM and USDM are trademarks of the Clinical Data Interchange Standards Consortium. Claude is a trademark of Anthropic. This book is not affiliated with or endorsed by any of them.

© 2026 DataStep Labs. All rights reserved.