Before and after the unblinding
In this chapter
- Say why blinding matters for the analysis, and what must be ready before the unblinding.
- Run the real data with a dummy treatment, and read what changes and what stays.
- Put the real treatment back as a person, and see the result of the study.
- Time
- 25 minutes, of which about 5 minutes of R
- At the end you have
- every program proven on the real data under a dummy treatment (p = 0.952), then the real treatment back and the result of the study (p = 0.245).
18.1 The idea: ready before you know
Section titled “18.1 The idea: ready before you know”In a blinded trial, nobody who runs the study knows which patient takes which treatment. Blinding protects the trial from bias in how patients are treated, assessed and analysed ICH E9 2.3.1. For the analysis it means: the SAP is final before the blind is broken ICH E9 5.1, and the programs must be ready then too. A program that is written after the results are known can be bent towards them.
So the programs are built and tested before the unblinding. On what data?
- Dummy data (chapter 21) are made up. They test the plan, but they lack the real quirks: the partial dates, the late visits, the real pattern of dropout.
- The real data with a dummy treatment keep every real record and change only one thing: which arm each patient is in. This is a made-up randomization. Every program meets the real data, and no result means anything.
Sapling does the second in one command, and swaps the real treatment back at the unblinding.
| Data | With the dummy treatment |
|---|---|
DM ARM, ARMCD, ACTARM, ACTARMCD |
the dummy arm of each randomized patient; the planned and the actual arm move together |
EX EXTRT, EXDOSE |
the dose of the patient’s dummy arm |
| everything else: dates, visits, adverse events, labs, questionnaires | the real data, unchanged |
18.2 A dummy treatment
Section titled “18.2 A dummy treatment”$ 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)The arms of the 254 randomized patients are shuffled with seed 7. 171 patients get another arm than their real one. The
groups keep their sizes: 86 on placebo, 84 and 84 on the two doses. The same seed gives the same assignment. The real DM
and EX are kept in sdtm/.real/, and sdtm/DUMMY-TREATMENT.md marks the study.
$ sapling run...adam data PASS: 7 of 7 programs BATCH: CLEAN; out/adam/data (20.1 s)...tlf run PASS: 12 of 12 programs BATCH: CLEAN; out/tlf/listings, out/ard (18398 results of 53 analyses, ars_results.json) (99.7 s)...SAPLING RUN PASSThe whole output (26 lines)
$ sapling run adsl: BATCH: CLEAN (3.0 s) adae: BATCH: CLEAN (1.3 s) adqsadas: BATCH: CLEAN (2.6 s) adqscibi: BATCH: CLEAN (2.5 s) advs: BATCH: CLEAN (3.2 s) adlbc: BATCH: CLEAN (3.7 s) adlbh: BATCH: CLEAN (3.1 s)adam data PASS: 7 of 7 programs BATCH: CLEAN; out/adam/data (20.1 s)adam check SKIP: no reference to compare with (sapling.yml reference.adam) (0.0 s) t14_1_1: BATCH: CLEAN (3.1 s) t14_1_2: BATCH: CLEAN (3.0 s) t14_2_1: BATCH: CLEAN (3.9 s) t14_3_1: BATCH: CLEAN (3.3 s) t14_3_2: BATCH: CLEAN (3.0 s) t14_4_1: BATCH: CLEAN (3.2 s) t14_5_1: BATCH: CLEAN (3.3 s) t14_5_2: BATCH: CLEAN (6.4 s) t14_5_3: BATCH: CLEAN (2.9 s) t14_6_1: BATCH: CLEAN (44.2 s) t14_6_2: BATCH: CLEAN (3.6 s) t14_7_1: BATCH: CLEAN (13.7 s)tlf run PASS: 12 of 12 programs BATCH: CLEAN; out/tlf/listings, out/ard (18398 results of 53 analyses, ars_results.json) (99.7 s)tlf check SKIP: no reference to compare with (sapling.yml reference.tlf) (0.0 s)120 sSAPLING RUN PASSEvery program runs CLEAN on the real data. The agent checks the primary p-value in the ARD with one grep on the
operation’s id, as it would in any loop:
# 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",,"",""p = 0.952: no effect under a made-up treatment, as it should be. The programs work; the number means nothing.
$ sapling final...ADaM MADE adam.spec fresh PASS: adam-spec.qmd, out/adam/spec (7 data sets, define.md) adam.programs fresh PASS: out/adam/programs (7 programs: ADSL -> ADAE -> ADQSADAS -> ADQSCIBI -> ADVS -> ADLBC -> ADLBH) adam.data fresh PASS: 7 of 7 programs BATCH: CLEAN; out/adam/data adam.check fresh SKIP: no reference to compare with (sapling.yml reference.adam) - made with a dummy treatment (sdtm/DUMMY-TREATMENT.md): the real data under a made-up randomization, never a result of the study [statistician] at the unblinding: sapling unblind --randomization <real list> --by NAME, then sapling final --make...SAPLING FINAL: 0 of 4 FINAL (SAP NOT FINAL, ADaM MADE, TLFs MADE, Dashboard MISSING)The whole output (36 lines)
$ sapling finalSAP NOT FINAL sap.structured fresh PASS: out/sap/sap.md, sap.html (234 blocks) sap.json fresh PASS: out/sap/sap.json sap.pdf fresh PASS: out/sap/sap.pdf (Quarto, Typst; the extension _extensions/sapling) - 11 item(s) of the scorecard open (agent score 94/100) [agent] sapling next -> one block -> sapling round - 80 of 84 block(s) not agreed [statistician] sapling judge; sapling agree <block> --by NAME - the plan is not approved [statistician] approved: under sapling: in the front matter, status: APPROVED (only a person writes it)
ADaM MADE adam.spec fresh PASS: adam-spec.qmd, out/adam/spec (7 data sets, define.md) adam.programs fresh PASS: out/adam/programs (7 programs: ADSL -> ADAE -> ADQSADAS -> ADQSCIBI -> ADVS -> ADLBC -> ADLBH) adam.data fresh PASS: 7 of 7 programs BATCH: CLEAN; out/adam/data adam.check fresh SKIP: no reference to compare with (sapling.yml reference.adam) - made with a dummy treatment (sdtm/DUMMY-TREATMENT.md): the real data under a made-up randomization, never a result of the study [statistician] at the unblinding: sapling unblind --randomization <real list> --by NAME, then sapling final --make
TLFs MADE tlf.spec fresh PASS: tlf-spec.qmd, out/tlf/spec (the contract; ARS JSON Schema: PASS (0 error(s))) tlf.shells fresh PASS: out/tlf/shells: 12 shell(s) from the structured SAP (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) tlf.qc-spec fresh PASS: out/tlf/qc-spec: 12 QC specification(s) from the structured SAP tlf.programs fresh PASS: out/tlf/programs (12 programs, RESULT: CLEAN) tlf.run fresh PASS: 12 of 12 programs BATCH: CLEAN; out/tlf/listings, out/ard (18398 results of 53 analyses, ars_results.json) tlf.check fresh SKIP: no reference to compare with (sapling.yml reference.tlf) - made with a dummy treatment (sdtm/DUMMY-TREATMENT.md): the real data under a made-up randomization, never a result of the study [statistician] at the unblinding: sapling unblind --randomization <real list> --by NAME, then sapling final --make
Dashboard MISSING dashboard missing - not made: dashboard [agent] sapling final --make (sapling build, run, dashboard --check)
SAPLING FINAL: 0 of 4 FINAL (SAP NOT FINAL, ADaM MADE, TLFs MADE, Dashboard MISSING)18.3 The unblinding
Section titled “18.3 The unblinding”The unblinding is a person’s act. In a process of an agent it is refused:
# in the agent's terminal$ sapling unblind --restore --by "A. Statistician"sapling unblind: refused: this is a process of an agent (SAPLING_AGENT is set). Only a person unblinds the study: run it yourself in your terminalYou run it in your own terminal. Here the data transfer has the real arms, so --restore puts back the real DM and EX
of sdtm/.real/ (with a randomization list from the IxRS you would use --randomization <list> --by NAME):
$ 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)Sapling records who unblinded, when, and what, in .sapling/unblinding.json. Then every program runs again, and the
agent checks the same row of the ARD:
$ sapling run...adam data PASS: 7 of 7 programs BATCH: CLEAN; out/adam/data (20.1 s)...tlf run PASS: 12 of 12 programs BATCH: CLEAN; out/tlf/listings, out/ard (18392 results of 53 analyses, ars_results.json) (99.5 s)...SAPLING RUN PASSThe whole output (26 lines)
$ sapling run adsl: BATCH: CLEAN (3.1 s) adae: BATCH: CLEAN (1.3 s) adqsadas: BATCH: CLEAN (2.6 s) adqscibi: BATCH: CLEAN (2.5 s) advs: BATCH: CLEAN (3.1 s) adlbc: BATCH: CLEAN (3.7 s) adlbh: BATCH: CLEAN (3.2 s)adam data PASS: 7 of 7 programs BATCH: CLEAN; out/adam/data (20.1 s)adam check SKIP: no reference to compare with (sapling.yml reference.adam) (0.0 s) t14_1_1: BATCH: CLEAN (3.2 s) t14_1_2: BATCH: CLEAN (3.0 s) t14_2_1: BATCH: CLEAN (3.8 s) t14_3_1: BATCH: CLEAN (3.3 s) t14_3_2: BATCH: CLEAN (3.0 s) t14_4_1: BATCH: CLEAN (3.2 s) t14_5_1: BATCH: CLEAN (3.2 s) t14_5_2: BATCH: CLEAN (6.4 s) t14_5_3: BATCH: CLEAN (2.9 s) t14_6_1: BATCH: CLEAN (44.3 s) t14_6_2: BATCH: CLEAN (3.6 s) t14_7_1: BATCH: CLEAN (13.6 s)tlf run PASS: 12 of 12 programs BATCH: CLEAN; out/tlf/listings, out/ard (18392 results of 53 analyses, ars_results.json) (99.5 s)tlf check SKIP: no reference to compare with (sapling.yml reference.tlf) (0.0 s)120 sSAPLING RUN PASS# 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",,"",""With the real treatment, p = 0.245: the value of the study’s report (Table 14-3.01 of the CSR). The same programs that ran on the dummy treatment now give the result of the study, without a single change.
Your turn 18.1 What did the dummy run prove?
The run with the dummy treatment gave p = 0.952. What did that run prove, and what did it not prove?
Show the answer
It proved that every program runs CLEAN on the real data: every ADaM data set, every table, every one of the 53 analyses. It proved nothing about xanomeline: the arms were made up, so 0.952 is the p-value of a random split of the patients. Under a made-up treatment a large p-value is what you expect, but any value would have been possible by chance.
What you learned
- Blinding protects the analysis: the SAP and the programs are ready before the blind is broken (ICH E9 2.3.1, 5.1).
- A dummy treatment keeps the real data and shuffles only the arms; no output made with it is ever final.
- The unblinding is a person’s act, recorded; the same programs then give the study’s result, p = 0.245.
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.