The whole path in one hour
In this chapter
- Run every step once, from the protocol to
SAPLING FINAL: 4 of 4 FINAL. - See which steps are yours and which are the agent’s.
- Know which chapter to read for each step.
- Time
- about one hour in the lab: most of it is reading; the R runs take a few minutes each
- At the end you have
- the four products of the pilot, and a map of the chapters that explain each step.
This page is the map. Each step shows one command and the lines of its real output that matter. The chapters explain the statistics and the choices behind each step. Run the steps in the terminal of the lab, from the folder of the lab.
-
A first draft from the protocol. Sapling reads the protocol (USDM) and the metadata of the SDTM data and writes
sap.qmd. Every block cites the protocol sentence it rests on. Chapter 4Terminal $ sapling new pilot --protocol protocol/usdm.json --sdtm data/sdtm --no-opencreate protocol/usdm.jsoncreate sdtm/ (13 SDTM data sets linked from ../data/sdtm; sdtm.json: their metadata)create protocol/protocol.json (the page index of the protocol)create sap.qmd (964 lines: sapc init and the omakase defaults; 12 tables: T14_1_1, T14_1_2, T14_2_1, T14_3_1, T14_3_2, T14_4_1, T14_5_1, T14_5_2, T14_5_3, T14_6_1, T14_6_2, T14_7_1)create README.md, AGENTS.md (the rules of an AI agent), .gitignore, custom/, out/, .sapling/, _extensions/sapling/ (the Quarto extension of Sapling: sapling sap pdf, Quarto preview)create .Rprofile and .sapling/ (the R engine ~/.vscode-remote/extensions/datastep-labs.sapling-sap-0.16.2/sapling/engine, in place)check 0 error(s), 4 warning(s): SAPLING CHECK PASS2.3 s. Next: cd pilot && sapling build (open decisions: sapling decide) -
The scorecard. The agent score measures what an agent can improve. Readiness is yours. Chapter 5
Terminal $ sapling round --note "the first draft"...AGENT SCORE 84/100...READINESS NOT READY (the statistician's)Decisions 22 open decision(s)Agreed 0 of 80 block(s) agreedApproved not approved...SAPLING EVAL: agent score 84/100; NOT READY (22 open decision(s) for the statistician; 80 of 80 block(s) not agreed); saved as round 1 -
The agent’s loop. The agent (or you) writes one block, checks it in its place, and measures again. Here: how the primary analysis handles missing data. Chapters 6 to 8
Terminal $ sapling block check md.qmd --after T14_3_1 --writecites 4.3.2: "The primary analysis of ADAS-Cog (11) and CIBIC+ will be the 24-week endpoint, which is defined for each patient and variable as the last measurement obtained postrandomization (prior to protocol defined reduction in dose)."makes missing_data MD_T14_3_1_CHG (line 398)BLOCK CHECK PASS: 0 error(s); written to sap.qmdTerminal $ sapling round --note "the missing data of the primary analysis"...AGENT SCORE 90/100 (+6 since round 1)...AGAINST ROUND 1: IMPROVED (estimands 75->88, rigour 77->91, complete 70->74); 5 item(s) answered... -
Your judgment. You read each block in the dossier, ask for changes, and agree to the text you read. Chapter 9
Terminal $ sapling agree EST1 MD_T14_3_1_CHG MULT SENS1 --by "A. Statistician" --note "read in the dossier"AGREED estimand EST1 (line 332, text 4e7b5446fc6b) by A. StatisticianAGREED missingdata MD_T14_3_1_CHG (line 398, text 5346ec7fda04) by A. StatisticianAGREED multiplicity MULT (line 431, text bbff2d0ced00) by A. StatisticianAGREED sensitivity SENS1 (line 471, text a8b3fc378e0f) by A. Statistician -
Your decisions. You answer the 22 choices the protocol leaves open. Chapter 10
Terminal $ sapling decide --file answers.tsv --by "A. Statistician"decide 22 decision(s) recorded by A. Statistician on 2026-11-20; 0 open; SAPLING CHECK PASS -
The specifications, the programs, the data and the tables.
sapling buildmakes them from the SAP;sapling runruns every program in R through DataStep Studio for R. Chapters 11 to 17Terminal $ sapling build...SAPLING BUILD PASSTerminal $ sapling run...adam data PASS: 7 of 7 programs BATCH: CLEAN; out/adam/data (19.8 s)...tlf run PASS: 12 of 12 programs BATCH: CLEAN; out/tlf/listings, out/ard (18392 results of 53 analyses, ars_results.json) (91.2 s)...SAPLING RUN PASS -
A dummy treatment. Before the unblinding, the programs run on the real data with a made-up randomization. The primary p-value means nothing here, as it should. Chapter 18
Terminal $ sapling blind --seed 7blind DUMMY TREATMENT (permute): 254 randomized patients, 171 with another arm than in the data; Xanomeline Low Dose 84, Placebo 86, Xanomeline High Dose 84sdtm/DUMMY-TREATMENT.md says so; the real DM and EX are in sdtm/.real/. Next: sapling run (the outputs with the dummy treatment, never final)# in the agent's terminal$ grep DR_1_pval out/ard/t14_3_1.csv"T14_3_1_CHG_CMP","T14_3_1_CHG_DR_1_pval","PLANNED","","","","","","","","","","","","","","",0.951515853331393,"0.952",3,"Change from baseline to Week 24","Comparison by Treatment","P",,"","" -
The unblinding. A person puts the real treatment back. Then the programs run again. Chapter 18
Terminal $ sapling unblind --restore --by "A. Statistician"unblind the real DM and EX of sdtm/.real/ are back; by A. Statistician (.sapling/unblinding.json). Next: sapling run (every output again, with the real treatment)# in the agent's terminal$ grep DR_1_pval out/ard/t14_3_1.csv"T14_3_1_CHG_CMP","T14_3_1_CHG_DR_1_pval","PLANNED","","","","","","","","","","","","","","",0.244705673868529,"0.245",3,"Change from baseline to Week 24","Comparison by Treatment","P",,"","" -
Your approval, and the four products. You approve the SAP when every block is agreed.
sapling final --makemakes everything again from the approved SAP and judges the four products. Chapters 19 and 20Terminal $ sapling approve --by "A. Statistician" --role statisticianAPPROVED by A. Statistician (statistician), 2026-11-20: status APPROVED. Next: sapling final --makeTerminal $ sapling dashboard --check --no-browser...SAPLING FINAL: 4 of 4 FINAL (SAP FINAL, ADaM FINAL, TLFs FINAL, Dashboard FINAL)Next: sapling package (the submission package: the SAP, the specs, the data, the programs, the outputs)
The approved SAPFINALsap.qmd, its PDF and its structured form. Every block cites the protocol; you agreed to each one.
The ADaM dataFINALSeven analysis data sets made in R from the SDTM data, checked against the ADaM Implementation Guide.
The tablesFINALTwelve tables in R, and every number in the analysis results data (ARD): 18,392 numbers.
The dashboardFINALThe study for management, with filters. Its gate checks every number on screen against the ARD.
SAPLING FINAL: 4 of 4 FINAL (SAP FINAL, ADaM FINAL, TLFs FINAL, Dashboard FINAL)The last line of sapling final --make, drawn as the four products. Click a card for its chapter.What you learned
- Each step is one command, and four of them are yours: agree, decide, unblind, approve.
- One command makes each step, and each prints a verdict: PASS, IMPROVED, READY, FINAL.
- The primary p-value is 0.952 under the dummy treatment and 0.245 after the unblinding: the value of the study’s report.
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.