SDTM All lessons Scene 1 / 12

SDTM · Interactive Lesson

SDTM Mapping Spec Walkthrough

12 scenes· ~22 min· pairs with the article

Step through the scenes, pass the checkpoint quizzes, and try the hands-on exercises. Progress saves locally in this browser — no account, no tracking.

Scene index · 12 scenes
  1. ConceptWhere Did That Value Come From?
  2. ConceptThe Spec Is a Three-Party Contract
  3. ConceptColumn Anatomy: Five Auditable Columns
  4. CheckpointSpec Basics Check
  5. ConceptWalk the VS Domain: Fourteen Rows
  6. Hands-onAssemble Defensible VS Spec Rows
  7. ConceptFive Hygiene Rules
  8. ConceptFrom Rows to Code
  9. ConceptFrom Spec to define-XML and the Modern Workflow
  10. ConceptThe Agentic Way: Keep the Spec Authoritative
  11. CheckpointFinal Knowledge Check
  12. ConceptSummary: The Spec as the Contract
Concept1 / 12

Where Did That Value Come From?

Where Did That Value Come From?

VS DOMAIN · THE ONE VALUE THE REVIEWER ASKS ABOUT

USUBJID=004   VISIT=Week 8   VSTESTCD=SYSBP   VSORRES=142   VSORRESU=mmHg

Reviewer: “Where did this value come from?”

Program trace

HOW it was computed

Mapping specification

WHY computed this way

WHO approved the decision

Spec columns

VS row-by-row

Hygiene rules

define-XML

Lesson part: opening (L1). Drop the learner into a real inspection moment: a reviewer points at one VS value, and only the mapping specification can answer why it was computed that way and who approved it.

Speaker notes

Picture a reviewer pointing at one Vital Signs (VS) value: subject 004, week 8, Vital Signs Test Code (VSTESTCD) SYSBP, result 142 millimetres of mercury. Your program can explain how that number was computed, but only the mapping specification explains why it was computed that way, and who approved that decision. The studies that answer this calmly all share one artifact: a spec where every Study Data Tabulation Model (SDTM) variable traces to a source, a transformation, and a decision owner. Today we cover spec column anatomy, a row-by-row VS walk, hygiene rules, and how that spec becomes define Extensible Markup Language (define-XML) and machine-usable code.

Concept2 / 12

The Spec Is a Three-Party Contract

The Spec Is a Three-Party Contract

The spec exists so the three readings never conflict.

Data Management

To know what was assumed about data collection.

Programmers

To know exactly what to build.

Reviewers / Inspectors

To trace any submitted value back to a source.

Enforcement rule: every mapped variable must trace to a spec row.

Code that outputs a variable with no spec row is a finding.

Raised during internal QC or inspection — whichever comes first.

Lesson part: concept (L1). Establish the core purpose of a mapping specification and its enforcement rule before looking at any column.

Speaker notes

This slide calls the mapping spec a three-party contract, because three groups read it for different reasons. Data management reads it to know what was assumed about collection, and programmers read it to know exactly what to build. Reviewers and inspectors read it to trace any submitted value back to a source. The spec exists so those three readings never conflict. The enforcement rule is simple: every mapped variable must trace to a spec row. Code that outputs a variable with no spec row is a finding, raised during internal quality control (QC) or inspection, whichever comes first.

Concept3 / 12

Column Anatomy: Five Auditable Columns

MAPPING SPEC · COLUMN ANATOMY

Five Auditable Columns

A spec row is a contract.

Five auditable answers per target variable.

1 · Target2 · Source3 · Transformation4 · CT / Origin5 · Notes / Query
VS.VSSTRESNRAW.VS.RESULTif °F: (RESULT − 32) × 5/9UNIT codelist; Origin = DerivedQ-117 · pending DM response

Drop any column → the contract breaks

Lesson part: concept (L1). Teach the five questions that make one mapping spec row auditable, using the published example row.

Speaker notes

Each mapping spec row is a contract answering five auditable questions about one target variable. Target names the Study Data Tabulation Model, or SDTM, variable being produced, like the Vital Signs, or VS, variable VS.VSSTRESN; Source names the raw dataset variable, here RAW.VS.RESULT, or the word assigned. Transformation must be a formula, not prose — for example, if the temperature is in Fahrenheit, subtract 32 and multiply by five ninths. Controlled Terminology, or CT, and Origin carries the codelist binding, such as UNIT, plus whether the value is from the Case Report Form, or CRF, derived, or assigned — here Origin equals Derived. Notes and Query records open questions, the decision owner, and dates, like Q-117 pending Data Management, or DM, response. Drop any one of these five columns, and the row stops being a contract.

Checkpoint4 / 12

Spec Basics Check

1 A defensible Study Data Tabulation Model (SDTM) mapping specification is read by three parties. Which option correctly identifies those parties and the primary need each one has from the specification?

2 In an SDTM mapping spec, each variable row is a contract. Which five columns must a defensible row contain for a target SDTM variable such as Vital Signs Test Code (VSTESTCD) in the Vital Signs (VS) domain? Select all five. (select all that apply, then Check)

3 While running an SDTM program for the Vital Signs (VS) domain, the code writes the variable Vital Signs Sequence Number (VSSEQ), but no row in the approved mapping specification names VSSEQ. According to the contract model, what audit consequence does this create and what must you do before the VS domain can be considered defensible? (reflect, then reveal)

Reveal analysis
Reference answer: No spec row means no contract for VSSEQ, so the output is undocumented and not defensible. QC has no approved rule to test it against, and a reviewer or auditor cannot trace the variable to an approved source and derivation. You must stop treating the dataset as final, add an approved spec row for VSSEQ with the required metadata, obtain review and approval, and rerun the VS program. The final SDTM output must contain no variable whose name is absent from an approved spec row.
Speaker notes

This checkpoint quiz tests your grasp of the Study Data Tabulation Model (SDTM) mapping specification basics. For the first question, a defensible SDTM mapping specification is read by three parties. The correct answer is B, because the implementing statistical programmer needs explicit source-to-target derivation rules, quality control (QC) needs independent testable target rules, and the regulatory reviewer or auditor needs to trace an approved specification row to the emitted SDTM output. For the second question, a defensible SDTM specification row for a target variable such as Vital Signs Test Code (VSTESTCD) in the Vital Signs (VS) domain must contain five columns: the target variable name, the variable label, the source mapping reference, the exact derivation instruction, and controlled terminology or permitted-value constraints, with an explicit not applicable when no codelist applies. The correct answer is A, B, C, D, and E. For the third question, if your SDTM program writes Vital Signs Sequence Number (VSSEQ) but no approved specification row names it, the output is undocumented and not defensible, so you must stop treating the dataset as final, add an approved specification row for VSSEQ with the required metadata, obtain review and approval, and rerun the VS program.

Concept5 / 12

Walk the VS Domain: Fourteen Rows

Walk the VS Domain: Fourteen Rows

Vital Signs (VS) mapping for Study XYZ-001 — fourteen-rows specification verbatim from published define-XML · CT = Controlled Terminology · DM = Demographics
RowTarget VariableOrigin / CTSource → Transformation / Note
1VS.STUDYIDAssignedConstant = "XYZ-001"
2VS.DOMAINAssignedConstant = "VS"
3VS.USUBJIDDerivedJoin DM on SUBJID; reuse DM.USUBJID
4VS.VSSEQDerivedCount within USUBJID after sort by VSTESTCD, VSDTC, VSPOS
5VS.VSTESTCDSource (CRF)Raw VS test short name
6VS.VSTESTSource (CRF)Decode VSTESTCD to test name
7VS.VSCATSource (CRF)Vital-sign category, e.g., "VITAL SIGNS"
8VS.VSORRESSource (CRF)Raw result as collected
9VS.VSSTRESCDerived / Value-LevelVSTESTCD = TEMP & unit = F: (VSORRES - 32) x 5/9; else keep VSORRES
10VS.VSSTRESNDerivedNumeric value from VSSTRESC
11VS.VSSTRESUDerived / CTStandard unit CT: TEMP => "C"
12VS.VSPOSSource / QueryOpen Query Q-117: confirm "Supine"
13VS.VSDTCSource (CRF)Raw collection date/time (ISO 8601)
14VS.VSDYDerivedStudy day vs DM.RFSTDTC; +1 if on/after, negative if before, no Day 0

Lesson part: real-data walkthrough (L1). Step through the complete VS mapping specification for Study XYZ as published in the source document; every target, source, transformation, CT/origin, and note shown comes verbatim from that table.

Speaker notes

This is the complete Vital Signs, or VS, specification: fourteen rows, verbatim from the published define-XML, that is, Extensible Markup Language. Rows one and two are assigned constants: STUDYID is XYZ-001, and DOMAIN is VS. Row three derives USUBJID, the unique subject identifier, by joining Demographics, or DM, on SUBJID and reusing that value verbatim. Row four builds VSSEQ, the Vital Signs sequence number, as a count within USUBJID after a deterministic sort by VSTESTCD, VSDTC, and VSPOS, meaning test code, collection date and time, and position. Row nine is value-level: if the test code is TEMP and the unit is F, convert with input minus thirty-two, times five over nine; otherwise keep the raw result. Rows twelve and fourteen carry queries and conventions: VSPOS holds open query Q-117 about Supine, and VSDY has no day zero.

Hands-on6 / 12

Assemble Defensible VS Spec Rows

Hands-on interactive — if it does not load, open the paired article and try the exercise there.

Speaker notes

In this hands-on exercise, you work on the website at jaimeyan.com/learn rather than in the video, assembling four incomplete Vital Signs, or VS, specification rows: the sequence number, VSSEQ; the numeric standard result with its standard unit, VSSTRESN and VSTRESU; the position, VSPOS; and the study day, VSDY. For each Target you select the correct Source, Transformation, Controlled Terminology and Origin, and Notes or Query block, and when a choice is wrong the feedback points you back to the source row, because a blank row is always better than a guessed rule. So after the video ends, open jaimeyan.com/learn and try it yourself, so you can defend every row you write.

Concept7 / 12

Five Hygiene Rules

Five Hygiene Rules

1

One row per target variable

VSORRES ≠ VSSTRESN — their sources and rules differ.

2

Transformations as formulas, not prose

Formula beats prose: °C = (°F − 32) × 5/9.

3

Unresolved rows carry an open query ID

Open Q-117: blank row allowed; guessing is not.

4

Constants get rows too

Constants live in define-XML; record each assignment.

5

Every revision is dated and owned

The file names the owner and date of each revision.

Lesson part: concept (L1). Teach the five rules that keep a mapping specification defensible in inspection.

Speaker notes

Rule one: one row per target variable, because Vital Signs Original Results, or VSORRES, and Vital Signs Standard Results Numeric, or VSSTRESN, have different sources and different rules. Rule two: transformations as formulas, not prose — standardize units is a wish, but Celsius equals Fahrenheit minus 32 times 5 divided by 9 is a specification. Rule three: unresolved rows carry an open query identifier — a blank transformation is allowed while Q-117 is open, but guessing is never allowed. Rule four: constants get rows too — assigned variables appear in Define Extensible Markup Language, or define-XML, so record each assignment in the spec. Rule five: every revision is dated and owned — the file itself must answer 'someone changed the temperature rule in March.'

Concept8 / 12

From Rows to Code

From Rows to Code

VS Spec Rows 7–10 → Published SAS Snippet

Published SAS data step · raw.vs → VS

data vs; /* from raw.vs, rows 7-10 */

set raw.vs;

keep USUBJID VSSEQ VSTESTCD VSORRES VSORRESU

VSSTRESN VSSTRESU;

run;

Clean spec → mechanical transcription. Code holds no judgment.

Q-117 fix: one spec row, then one program line — review as one change.

Lesson part: concept/data application (L1). Show how rows 7 through 10 of the VS specification transcribe almost mechanically into the SAS snippet published in the source document.

Speaker notes

In this scene, we move from spec rows to code. The published Statistical Analysis System (SAS) data step builds the Vital Signs (VS) domain from the raw Vital Signs dataset. Rows 7 through 10 of the Study Data Tabulation Model (SDTM) specification transcribe almost mechanically into that SAS snippet. The code keeps the Unique Subject Identifier (USUBJID), Vital Signs Sequence Number (VSSEQ), Vital Signs Test Code (VSTESTCD), Vital Signs Original Result (VSORRES), Vital Signs Original Units (VSORRESU), Vital Signs Standardized Result in Numeric (VSSTRESN), and Vital Signs Standardized Units (VSSTRESU). Notice what is missing: there is no judgment, because every branch exists because a spec row says it does. When the Q-117 answer arrives, the fix lands in one spec row first, then in one program line, and the two changes review together.

Concept9 / 12

From Spec to define-XML and the Modern Workflow

From Spec to define-XML

the Modern Workflow

SDTM spec elementdefine-XML node
Origin column (CRF / Derived / Assigned)Origin attribute on ItemDef
CT column (VSTESTCD)Codelist reference (CDISC CT)
Value-level rule, e.g., row 9Computational method via value-level metadata

Generated, never hand-typed: spec ↔ define-XML stay aligned.

• Spec-as-data: CSV / YAML, version-controlled

  → mapping change = a PR diff

• CI loop: change → rebuild + generate define-XML

  → re-run validation; drift fails the build

Lesson part: concept (L2). Show how spec columns project almost one-to-one into define-XML, then how spec-as-data, spec-first QC, and CI keep spec, code, and metadata in lockstep.

Speaker notes

On this slide, we move from the specification to define-XML, the metadata standard from the Clinical Data Interchange Standards Consortium, or CDISC. The Origin column, meaning Case Report Form, Derived, or Assigned, becomes the Origin attribute on each ItemDef. The Controlled Terminology, or CT, column, such as Vital Signs Test Code, or VSTESTCD, becomes a codelist reference. A value-level rule, like row nine, becomes a computational method through value-level metadata. This define-XML must be generated from the spec, never hand-typed, so spec and metadata cannot disagree. The spec itself is data: Comma-Separated Values, or CSV, or YAML Ain't Markup Language, or YAML, files under version control, so a mapping change is a Pull Request, or PR, diff; then Continuous Integration, or CI, closes the loop: change, rebuild domains, regenerate define-XML, re-run validation, and drift fails the build.

Concept10 / 12

The Agentic Way: Keep the Spec Authoritative

The Agentic Way:

Keep the Spec Authoritative

Where agents are strong

• Formula-grade spec rows → code in one pass

• Mechanical task; agents handle it consistently

Failure mode is at the edges

• Code fixed while spec row stays put → drift

• Blank rule row filled with agent invention → gap-filling

Make drift mechanical too

• Derive expected variables from spec / define-XML (USUBJID, VSSEQ, VSTESTCD) and diff vs produced datasets in CI

Volatile layer — tool specifics last verified 2026-08-30; re-verify before relying on them.

Lesson part: concept (L3). Cover the agent-era failure mode of drift and gap-filling, explicitly flagged as volatile and time-sensitive.

Speaker notes

Now let's put the spec in the driver's seat for an agentic workflow. Agents are strong at the mechanical layer: they transcribe formula-grade specification rows into code accurately in one pass, and they do it consistently. The failure mode sits at the edges; an agent may fix a program while the spec row stays put, which is drift, or fill a blank transformation row with a plausible rule of its own, which is gap-filling. So make drift mechanical too: derive the expected variable list from the spec or the generated define-XML, where XML stands for Extensible Markup Language, and diff it against produced datasets in continuous integration, or CI. Finally, this tool-specific layer is volatile; it was last verified on August thirtieth, two thousand twenty-six, so re-verify before relying on it.

Checkpoint11 / 12

Final Knowledge Check

1 In a Vital Signs (VS) mapping specification, a row is auditable when it contains the critical metadata needed to trace and confirm the mapping, and each output row must follow the VS structure rule. Which answer best states the five required metadata fields and the rule that prevents two different measurements, such as systolic and diastolic blood pressure, from being packed into one original-result/standardized-result pair (VSORRES/VSSTRESN) row?

2 After walking through the VS mapping, you find that a source value in original result (VSORRES) has no confirmed standardized numeric result (VSSTRESN) code and a data-management query is open. What should you do? Select all that apply. (select all that apply, then Check)

3 Your organization uses a Continuous Integration (CI) pipeline for the VS domain. Explain why define-XML must be generated from the spec rather than from the final SAS dataset or from hand-written code. Then state the exact first action to take when an open data-management query about a VSORRES/VSSTRESN code is answered, before you regenerate define-XML and run CI. (reflect, then reveal)

Reveal analysis
Reference answer: define-XML is metadata about the SDTM domains; generating it from the spec keeps the metadata tied to the controlled source-to-target rules and makes drift visible in CI. Generating it from SAS code or from the final dataset is dangerous because hand-written code or data values can contain unresolved guesses that look valid. When a data-management query closes, the first action must be to update the specification row with the confirmed answer: choose the correct code-list term for the source value, enter the confirmed standardized numeric result for VSSTRESN if applicable, record the derivation/origin, and remove the open query ID. Only then should define-XML be regenerated from the updated spec and CI be run to compare the resulting define-XML against the VS dataset.
Speaker notes

This is the final knowledge check, so let's apply the Vital Signs (VS) mapping rules we just walked through. Question one asks which five metadata fields make a mapping spec row auditable and which structure rule keeps two different measurements apart. The correct answer is A: source dataset, source variable, target variable, transformation or derivation, and controlled terminology or codelist, with one VS record for each Vital Signs test, so two different Vital Signs Test Codes (VSTESTCD), such as systolic and diastolic blood pressure, never share a single Original Result (VSORRES) and Standardized Numeric Result (VSSTRESN) row. Question two is a multiple-response item about an unresolved VSORRES value with an open data-management query. The correct answers are A and C: leave the VSSTRESN transformation blank while keeping the open query ID visible against the row, and do not guess a mapping, because a tracked blank is safer than an invented rule that can pass checks and appear in define Extensible Markup Language (define-XML) as confirmed. Question three asks why define-XML must be generated from the spec rather than from the final SAS dataset or from hand-written code, and what happens first when a query closes in a Continuous Integration (CI) pipeline. The model answer: generating it from the spec keeps the metadata tied to the controlled source-to-target rules and makes drift visible in CI, and when the query about the VSORRES and VSSTRESN code is answered, your first action is to update the spec transformation, then regenerate define-XML and run CI.

Concept12 / 12

Summary: The Spec as the Contract

Summary: The Spec as the Contract

Spec = contract: a three-party agreement.

Every mapped variable traces to a spec row.

Row anatomy: Target · Source · Transformation · CT/Origin

Notes/Query — each row mirrors the 14-row VS walk.

Defensible: formulas, open query IDs, constants as rows

Dated and owned on every revision.

Same rows: define-XML and transcription code

Spec stays authoritative; CI diff catches divergence.

Article: /blog/sdtm-mapping-spec-walkthrough.html

Series: SDTM AE mapping → ADaM BDS: ADLB and ADVS

Lesson part: summary. Tie the lesson back to the paired article and to the series context for junior clinical programmers.

Speaker notes

So, the mapping specification is a contract: a three-party agreement where every mapped variable traces to a spec row. Every row answers five questions: target, source, transformation, controlled terminology and origin, and notes or queries. That is the anatomy of the fourteen-row vital signs (VS) domain walk you just saw. Keep it defensible: transformations as formulas, open query identifiers visible, constants as their own rows, every revision dated and owned. The same rows generate the define-XML — that is, Extensible Markup Language (XML) — file and transcribe into code; in agent-era tooling the spec stays authoritative while a continuous integration diff catches divergence. From Study Data Tabulation Model (SDTM) adverse events (AE) mapping, the series next moves to Analysis Data Model (ADaM) Basic Data Structure (BDS), covering the laboratory analysis dataset (ADLB) and the vital signs analysis dataset (ADVS).

✓

Lesson complete

Nice work — every scene seen. Keep the momentum going.

← → Space to navigate · progress is saved locally in your browser

AI Tutor

Ask the tutor