Tutorials › Biostatistics › Define.xml: What It Is and Why It Matters

CDISC & Regulatory Submissions

Define.xml: What It Is and Why It Matters

A practical guide to Define-XML for clinical programmers, including dataset metadata, variables, codelists, value-level metadata, origins, computational methods, document references, relationships, validation, and regulatory submission considerations.

Intermediate 20 min read

What You'll Learn

  • What Define-XML is and why it is used
  • How datasets and variables are described
  • How codelists and controlled terminology are represented
  • How value-level metadata works
  • How origins, methods, and document references are linked
  • How programmers build and validate Define-XML

Introduction

A clinical-trial submission contains much more than datasets.

A reviewer also needs to understand what those datasets mean.

If a dataset contains a variable called TRT01P, for example, the reviewer needs to know what the variable represents, what values it can contain, what its label is, what its data type is, and where the information originated.

The same principle applies to derived analysis variables.

If an analysis dataset contains a variable such as CHG, a reviewer may need to understand how that variable was derived and where the derivation is documented.

This is where Define-XML becomes important.

Key idea: Define-XML is a machine-readable metadata standard used to describe the structure and meaning of clinical-trial datasets and their associated metadata. It provides a formal description of datasets, variables, controlled terminology, derivations, origins, and related information so that reviewers and software can understand the submitted data.

What Is Define-XML?

Define-XML is a CDISC standard for representing metadata about tabular clinical-trial data in XML.

The word Define is important.

Define-XML does not primarily contain the patient-level observations themselves.

Instead, it describes those observations.

Conceptually:

$$ \text{Clinical Dataset} + \text{Metadata} \rightarrow \text{Understandable Submission} $$

For example, an SDTM domain such as DM may contain the actual records for study subjects.

Define-XML describes the structure of DM and explains what its variables mean.

Why Does Define-XML Matter?

Imagine receiving a dataset containing:

USUBJID   TRT01P          AGE   SEX
ABC001    Drug A          62    M
ABC002    Placebo         54    F
ABC003    Drug A          71    M

The values are visible, but several questions remain.

  • What does TRT01P mean?
  • Is "Drug A" a controlled terminology value?
  • What is the label of AGE?
  • Is AGE integer or floating point?
  • Where did SEX originate?
  • What standard defines the dataset structure?
  • Are there computational methods associated with any variables?

Define-XML provides structured metadata that answers these types of questions.

Think of Define-XML as the metadata blueprint for the submission. The SAS datasets, XPT files, or other submitted data contain the observations. Define-XML explains how those observations are structured and what they mean.

Define-XML Is Not the Dataset

One of the first concepts new clinical programmers should understand is the difference between data and metadata.

Component Purpose
Dataset Contains actual records and values
Define-XML Describes the structure and meaning of the dataset
Controlled terminology Defines standardized permissible values
Computational method Documents how a derived value was calculated
Document reference Points to supporting documentation

This distinction is fundamental to understanding CDISC submissions.

A Simple Analogy

Consider a book.

The actual book contains the content.

A catalog record might describe:

  • the title
  • the author
  • the publication date
  • the language
  • the number of pages

The catalog record does not replace the book.

It describes the book.

Define-XML plays a similar metadata role for clinical datasets.

Where Does Define-XML Fit in a Submission?

1
Study data: SDTM, ADaM, and other submitted datasets contain the observations.
2
Define-XML: describes the datasets, variables, codelists, origins, methods, and related metadata.
3
Controlled terminology: provides standardized concepts and permissible values where applicable.
4
Supporting documents: provide additional context such as the annotated CRF, SAP, or reviewer guides.
5
Regulatory review: reviewers use the metadata to understand and navigate the submitted data.

Define-XML and CDISC

Define-XML is part of the broader CDISC standards ecosystem.

It is commonly encountered alongside:

  • SDTM
  • ADaM
  • CDASH
  • Controlled Terminology
  • Dataset-XML
  • Annotated CRFs

These standards address different parts of the clinical-data lifecycle.

Standard / Artifact Primary Role
CDASH Standardizes data collection concepts
SDTM Standardizes tabulation datasets
ADaM Standardizes analysis datasets and analysis-ready structures
Controlled Terminology Standardizes terminology and coded values
Define-XML Describes dataset and metadata structures
Dataset-XML Provides a standardized XML representation of dataset data

The Basic Architecture of Define-XML

A Define-XML document contains several layers of metadata.

Figure 1. Simplified Define-XML Metadata Structure
A conceptual view of how the major metadata components fit together.
<ODM>
  └── <Study>
      └── <MetaDataVersion>
          ├── <Protocol>
          ├── <ItemDef>   Variable definitions
          ├── <CodeList>   Controlled terminology
          ├── <MethodDef>   Computational methods
          ├── <leaf>   Document references
          └── <ItemGroupDef>
              ├── Dataset metadata
              ├── Variable references
              └── Value-level metadata

The actual Define-XML structure is more detailed. This diagram is intended to provide a conceptual starting point rather than a complete schema diagram.

Datasets Are Represented as Item Groups

One important Define-XML concept is the ItemGroupDef.

An ItemGroupDef represents a dataset or dataset-like collection of variables.

For example:

<ItemGroupDef
    OID="IG.SDTM.DM"
    Name="DM"
    Repeating="No"
    SASDatasetName="DM">

    ...

</ItemGroupDef>

The exact attributes and metadata depend on the Define-XML version and implementation.

Conceptually, the ItemGroupDef tells the reviewer:

1
What the dataset is called.
2
What its metadata identifier is.
3
Which variables belong to it.
4
Whether the structure is repeating where applicable.
5
What other metadata applies to the dataset.

Variables Are Represented by Item Definitions

Individual variables are represented through ItemDef metadata.

Suppose DM contains:

USUBJID
SUBJID
SITEID
AGE
SEX
ARM

Define-XML can describe the metadata associated with each variable.

Variable Metadata Example
USUBJID Unique Subject Identifier
AGE Age
SEX Sex
ARM Description of Planned Arm

A variable definition can include information such as:

  • Name
  • Label
  • Data type
  • Length or significant digits where applicable
  • Origin
  • Controlled terminology
  • Method
  • Comments or references where applicable

Name and Label Are Different

A common beginner mistake is to think that the variable name and label are the same thing.

They are not.

For example:

Variable name:
AGE

Variable label:
Age

The name is the machine-oriented variable identifier.

The label is the human-readable description.

Programming perspective: The variable name is what the programmer uses in code. The label is what helps the reviewer understand the variable's meaning.

Data Types

Define-XML also provides metadata about the type of information stored in a variable.

Examples include:

Concept Example
Integer AGE = 62
Float AVAL = 12.75
Text SEX = "M"
Date/time Collection date and time

The exact representation depends on the Define-XML model and the underlying dataset implementation.

Why Data Types Matter

Consider the value:

12.50

A reviewer needs to know whether this represents:

  • A numeric laboratory measurement
  • A dose
  • A time duration
  • A score
  • A string that happens to contain digits

Metadata gives the value context.

Controlled Terminology

Clinical datasets frequently use standardized terminology.

For example, SEX might use values such as:

M
F
U

The meaning of these values can be represented through a CodeList.

Conceptually:

$$ \text{Variable} \rightarrow \text{CodeList} \rightarrow \text{Permitted Values} $$

This provides a formal relationship between the variable and its controlled values.

What Is a CodeList?

A CodeList defines a collection of permissible or standardized coded values.

For example:

Code Decode
M Male
F Female
U Unknown

The code is the stored value.

The decode is the human-readable meaning.

Why Codelists Matter

Without controlled terminology, two systems might represent the same concept differently.

For example:

Male
MALE
M
1

These could potentially represent the same underlying concept, but they are not interchangeable without metadata or transformation rules.

Controlled terminology promotes consistency.

External Controlled Terminology

A Define-XML document can also reference terminology maintained outside the document.

This is important for CDISC terminology because the metadata may identify the controlled terminology source rather than duplicating every possible concept definition unnecessarily.

Important distinction: A codelist can be represented in Define-XML, while the underlying terminology may originate from an external controlled-terminology source. The Define-XML metadata should make the relationship clear.

Value-Level Metadata

One of the most important advanced Define-XML concepts is value-level metadata, often abbreviated VLM.

Suppose one variable has different metadata depending on the value of another variable.

For example, a generic analysis variable might have different definitions depending on parameter.

Conceptually:

PARAMCD = "SYSBP"
AVAL    = Systolic Blood Pressure

PARAMCD = "DIABP"
AVAL    = Diastolic Blood Pressure

The same analysis variable, AVAL, can represent different concepts depending on PARAMCD.

Value-level metadata allows the metadata to become conditional.

Why Value-Level Metadata Is Necessary

Without VLM, the metadata might simply say:

AVAL = Analysis Value

That is technically useful but incomplete.

With value-level metadata, the metadata can explain that:

Parameter AVAL Meaning
SYSBP Systolic Blood Pressure
DIABP Diastolic Blood Pressure
PULSE Pulse Rate

This is especially important in BDS-style ADaM datasets.

Where Value-Level Metadata Commonly Appears

Value-level metadata is particularly relevant when:

  • A single variable represents multiple parameters.
  • Different parameter values have different labels.
  • Different parameters have different units.
  • Different parameters have different origins.
  • Different parameters have different derivation methods.
  • Different parameters have different controlled terminology.

This is one reason ADaM metadata can become substantially more complex than a simple domain-level data dictionary.

Origins

Another central Define-XML concept is the origin of a variable.

A reviewer may need to know whether a variable was:

  • Collected directly
  • Derived
  • Assigned by a sponsor
  • Provided by an external source
  • Obtained from another dataset

This information helps explain how the value came to exist.

Collected vs. Derived Variables

Consider:

AGE

If age was collected directly on a case report form, its origin is different from a derived variable such as:

CHG

where:

$$ CHG = AVAL - BASE $$

The derivation needs to be documented.

Key principle: Define-XML should allow a reviewer to understand not only what a variable means, but also where the information came from and, for derived variables, how it was produced.

Computational Methods

Derived variables may be associated with a MethodDef.

Suppose:

BASE = 120
AVAL = 108
CHG  = -12

The derivation is:

$$ CHG = AVAL - BASE $$

Define-XML can associate the derived variable with metadata describing this computational method.

Why Computational Methods Matter

A reviewer seeing:

CHG = -12

knows the result.

But the reviewer also needs to understand how the result was obtained.

For a straightforward variable:

$$ CHG = AVAL - BASE $$

the method is simple.

For a more complicated ADaM derivation, the method may involve:

  • Baseline selection
  • Visit selection
  • Imputation rules
  • Population criteria
  • Reference dates
  • Multiple source variables
  • Statistical algorithms

The metadata therefore becomes an important part of traceability.

Document References

Define-XML can also point to supporting documents.

Examples include:

  • Annotated CRF
  • Statistical Analysis Plan
  • Protocol
  • Reviewer guide
  • Other supporting documents

The goal is to connect the metadata with the documentation that explains the study and its analyses.

Define-XML and the Annotated CRF

The annotated CRF helps establish the relationship between collected clinical data and the standardized SDTM representation.

For example:

1
The investigator or site records information on the CRF.
2
The collected information is transformed into standardized datasets.
3
Define-XML describes the resulting dataset variables and their metadata.
4
Supporting references provide additional traceability.

Dataset-Level Metadata

Define-XML does not only describe variables.

It also describes datasets.

Dataset-level metadata can include information such as:

Metadata Purpose
Dataset name Identifies the dataset
Description Explains the dataset's purpose
Class Provides dataset classification information
Structure Describes the organization of records
Purpose Provides context for the dataset
Keys / identifiers Helps explain record identification

Dataset Structure Matters

A reviewer needs to know how records should be interpreted.

For example, an SDTM domain may have one record per subject per observation or multiple records per subject.

An ADaM BDS dataset may contain multiple records per subject corresponding to different parameters and analysis visits.

Define-XML helps describe these structures.

Keys and Record Identification

The structure of a dataset often depends on the variables needed to identify a record.

For example, a BDS dataset may conceptually be identified by:

$$ USUBJID + PARAMCD + AVISIT $$

although the appropriate key structure depends on the actual dataset.

The key point is that metadata helps the reviewer understand how records relate to one another.

SDTM Define-XML

For SDTM, Define-XML can describe standardized domains such as:

  • DM
  • AE
  • CM
  • LB
  • VS
  • EX
  • DS
  • MH
  • and many others

For example, the AE domain may contain:

USUBJID
AESEQ
AETERM
AEDECOD
AESTDTC
AEENDTC
AESEV
AESER

Define-XML describes what those variables represent.

ADaM Define-XML

Define-XML is equally important for ADaM datasets.

ADaM datasets often contain derived analysis variables whose interpretation depends on derivation rules.

For example:

BASE
AVAL
CHG
PCHG
ABLFL
ANL01FL

The metadata can explain:

  • What each variable means
  • Where it originated
  • How it was derived
  • Which controlled terminology applies
  • Which documents support the derivation

Define-XML for ADSL

ADSL is a useful example because it often contains a mixture of collected, assigned, and derived variables.

Variable Typical Concept Possible Origin
USUBJID Unique subject identifier Collected / assigned
AGE Age Derived or collected depending on implementation
TRT01P Planned treatment Assigned / derived
TRTSDT Treatment start date Derived
SAFFL Safety population flag Derived
ITTFL Intent-to-treat flag Derived

The exact origin and derivation depend on the study and analysis specifications.

Define-XML for BDS

BDS datasets illustrate why metadata can become complicated.

Consider:

USUBJID
PARAM
PARAMCD
AVAL
BASE
CHG
PCHG
AVISIT
AVALCAT1

The meaning of AVAL may change depending on PARAMCD.

The derivation of BASE may depend on a baseline selection algorithm.

The derivation of CHG depends on both AVAL and BASE.

This creates a network of metadata relationships.

A Metadata Dependency Chain

1
Source: clinical observation or source dataset.
2
Parameter: defines the analysis concept.
3
AVAL: contains the analysis value.
4
BASE: identifies the analysis baseline.
5
CHG: is calculated from AVAL and BASE.
6
PCHG: is calculated from CHG and BASE.

Example of a Computational Derivation

Suppose:

$$ BASE=120 $$

and:

$$ AVAL=108 $$

Then:

$$ CHG=108-120=-12 $$

The percentage change is:

$$ PCHG = \frac{108-120}{120}\times100 = -10\% $$

Define-XML can document these derived variables and their associated methods.

Define-XML Does Not Replace the SAP

This distinction is extremely important.

The Define-XML document can describe the computational method associated with a variable.

It does not necessarily replace the full statistical analysis plan.

The SAP may contain the broader statistical rationale, estimand definitions, analysis populations, missing-data strategies, sensitivity analyses, and inferential methodology.

Think of the relationship this way: The SAP explains the statistical analysis. Define-XML describes the metadata and provides machine-readable links to relevant derivations and supporting documentation.

Define-XML and Traceability

Traceability is one of the most important concepts in clinical data standards.

A derived analysis variable should ideally be traceable through the analysis process to its source.

Conceptually:

$$ \text{Source Data} \rightarrow \text{SDTM} \rightarrow \text{ADaM} \rightarrow \text{Tables/Figures} $$

Define-XML helps document portions of this chain by describing origins, derivations, and references.

What Does Origin Mean?

Origin describes where a variable's value comes from.

Common conceptual categories include:

Origin Meaning
Collected Value originates from collected study data
Derived Value is calculated using other information
Assigned Value is assigned according to study or sponsor rules
Predecessor Value is inherited or carried forward from another dataset or variable context
Protocol Information originates from protocol-defined information

The exact permitted and applicable origin concepts depend on the Define-XML version and implementation.

Define-XML Version Matters

Define-XML has evolved over time.

Different Define-XML versions provide different capabilities and structures.

A project should therefore establish the intended Define-XML version before metadata generation begins.

Best practice: Do not build a Define-XML generator around assumptions from an older project. Confirm the Define-XML version, applicable CDISC implementation guidance, and regulatory expectations for the submission.

Define-XML 2.x

Define-XML 2.x is widely encountered in modern clinical-trial submissions.

It provides a structured way to describe:

  • Datasets
  • Variables
  • Value-level metadata
  • Codelists
  • Methods
  • Comments
  • Documents
  • Relationships

The specific implementation should always be checked against the applicable Define-XML specification and regulatory guidance.

XML Basics for Clinical Programmers

You do not need to become an XML software engineer to work effectively with Define-XML.

However, you should understand the basic concepts.

XML uses nested elements.

For example:

<ItemDef OID="IT.AGE" Name="AGE">
    ...
</ItemDef>

Here:

  • ItemDef is the element.
  • OID is an attribute.
  • AGE is an attribute value.

XML Elements and Attributes

Consider:

<ItemDef
    OID="IT.AGE"
    Name="AGE"
    DataType="integer">
</ItemDef>

The element is:

<ItemDef>

The attributes include:

OID
Name
DataType

These attributes provide metadata about the item.

Object Identifiers

Define-XML uses identifiers extensively.

These identifiers allow metadata objects to reference one another.

For example:

IG.SDTM.DM
IT.SDTM.DM.USUBJID
IT.SDTM.DM.AGE
CL.SEX

The exact naming convention is implementation-specific.

The critical concept is that each metadata object needs an identifier that can be referenced elsewhere in the XML.

Why OIDs Matter

Suppose an ItemGroupDef references several variables.

The XML needs a reliable way to say:

$$ \text{Dataset} \rightarrow \text{Variable Definition} $$

Object identifiers provide that linkage.

Variable Ordering

Variable order can also matter.

For example, a dataset might be represented as:

USUBJID
SUBJID
SITEID
AGE
SEX
ARM

The Define-XML metadata should represent the intended structure and ordering appropriately.

This is one reason metadata generation should not simply consist of creating a random collection of variable definitions.

Comments

Comments provide another mechanism for communicating additional metadata.

They can be useful when a variable or dataset needs explanatory information that is not adequately represented by the basic metadata attributes.

For example:

Variable:
ANL01FL

Comment:
Flag identifies records included in the primary analysis.

The exact implementation should follow the Define-XML model.

Dataset Classes

Dataset metadata can also include information describing the general type or class of the dataset.

Examples in a CDISC environment can include concepts associated with:

  • Findings
  • Events
  • Interventions
  • Special-purpose domains
  • ADaM dataset classes

The appropriate classification depends on the standard and dataset.

Structure Descriptions

The structure description is another important part of dataset metadata.

For example, an SDTM dataset may have a structure such as:

One record per subject per adverse event

An ADaM dataset may have:

One or more records per subject per parameter per analysis visit

The structure statement helps reviewers understand how to interpret the rows.

Define-XML and Supplemental Qualifiers

SDTM submissions can include supplemental qualifier datasets such as SUPP--.

Metadata must account for these datasets and their relationships to the corresponding parent domains.

This illustrates an important principle:

Define-XML describes the submission as a connected metadata system. It is not simply a collection of independent variable dictionaries.

Define-XML and Relationships

Some datasets contain relationships that are important to interpretation.

Examples include relationships between:

  • Parent domains and supplemental qualifiers
  • Datasets and documents
  • Variables and codelists
  • Variables and methods
  • Variables and value-level metadata

Define-XML provides mechanisms for representing these relationships.

What a Define-XML File Might Conceptually Describe

Object Example
Dataset ADSL
Variable SAFFL
Label Safety Population Flag
Type text
Origin Derived
Method Safety population derivation
Supporting document Statistical Analysis Plan

Creating Define-XML: The Practical Workflow

1
Confirm the applicable Define-XML version.
2
Inventory all submitted datasets.
3
Extract dataset-level metadata.
4
Extract variable names, labels, types, lengths, and ordering.
5
Identify controlled terminology and codelists.
6
Identify variable origins.
7
Identify derived variables and computational methods.
8
Add value-level metadata where necessary.
9
Add document references and supporting metadata.
10
Validate the Define-XML against the datasets and applicable standards.

Step 1: Inventory the Datasets

Start with a complete inventory of the datasets included in the submission.

For example:

SDTM
  DM
  AE
  CM
  LB
  VS
  EX

ADaM
  ADSL
  ADAE
  ADLB
  ADVS
  ADEFF

Every submitted dataset needs appropriate metadata.

Step 2: Extract Variable Metadata

For each dataset, identify:

  • Variable name
  • Variable label
  • Data type
  • Length or significant digits where applicable
  • Variable order
  • Origin
  • Codelist
  • Method
  • Value-level metadata

Step 3: Identify Codelists

Build an inventory of all controlled terminology relationships.

For example:

Dataset Variable Terminology
DM SEX Sex terminology
DM RACE Race terminology
AE AESEV Severity terminology
AE AESER Seriousness terminology

Step 4: Identify Derived Variables

One of the most important programming tasks is identifying variables whose values are derived.

Examples include:

CHG
PCHG
BASE
ABLFL
ANL01FL
SAFFL
ITTFL
TRTSDT
TRTEDT

The exact derivation should be documented according to the study's standards and specifications.

Step 5: Identify Value-Level Metadata

Next ask:

Does the meaning of this variable depend on another variable?

If yes, value-level metadata may be necessary.

Typical examples include:

  • AVAL
  • AVALC
  • BASE
  • CHG
  • PCHG
  • Analysis parameters

Step 6: Add Document References

Identify the documents needed to explain the metadata.

Examples include:

  • Annotated CRF
  • SAP
  • Protocol
  • Analysis Data Reviewer's Guide
  • Study Data Reviewer's Guide

The exact documents required depend on the submission context.

Generating Define-XML From Metadata Tables

Many organizations maintain metadata in structured source tables before generating Define-XML.

For example:

DATASET  VARIABLE  LABEL                  TYPE
ADSL     USUBJID   Unique Subject ID      text
ADSL     AGE       Age                    integer
ADSL     SEX       Sex                    text
ADSL     SAFFL     Safety Population Flag text

A Define-XML generation process can transform this metadata into XML.

Why Metadata-Driven Programming Is Better

Manually typing hundreds or thousands of XML elements is error-prone.

A metadata-driven process can instead:

1
Read dataset metadata.
2
Read variable metadata.
3
Read codelist metadata.
4
Read derivation metadata.
5
Generate XML objects automatically.
6
Validate the generated result.

Example Metadata-Driven Structure

metadata/
    datasets.csv
    variables.csv
    codelists.csv
    methods.csv
    documents.csv
    vlm.csv

output/
    define.xml

The exact architecture varies by organization.

The important principle is to maintain a reproducible relationship between source metadata and generated Define-XML.

Programming Define-XML in SAS

Clinical programmers working in SAS may generate Define-XML using specialized metadata-generation tools, sponsor frameworks, or custom programming.

A simple metadata table might contain:

data variables;

length
  dataset $8
  variable $32
  label $200
  datatype $12
  origin $20;

dataset  = "ADSL";
variable = "AGE";
label    = "Age";
datatype = "integer";
origin   = "Derived";

run;

A production implementation would generally contain considerably more metadata.

Programming Define-XML in R

R can also be used to create and manipulate Define-XML metadata.

A metadata table can be represented as:

variables <- data.frame(
  dataset = c("ADSL", "ADSL", "ADSL"),
  variable = c("USUBJID", "AGE", "SEX"),
  label = c(
    "Unique Subject Identifier",
    "Age",
    "Sex"
  ),
  datatype = c(
    "text",
    "integer",
    "text"
  ),
  origin = c(
    "Collected",
    "Derived",
    "Collected"
  )
)

The metadata can then be transformed into the required Define-XML structure.

Do Not Confuse Dataset Generation With Define-XML Generation

A common misconception is that once the dataset is programmed, Define-XML is just documentation added at the end.

In reality, good Define-XML depends on metadata being available throughout the development lifecycle.

Better approach: Treat Define-XML as part of the metadata lifecycle rather than a last-minute submission deliverable.

Define-XML and the Study Data Reviewer

A reviewer may need to answer questions such as:

  • What does this variable mean?
  • Why does this variable exist?
  • Where did this value originate?
  • How was it derived?
  • Which terminology applies?
  • What dataset contains the source information?
  • What document explains the derivation?

A well-constructed Define-XML document makes these questions easier to answer.

Define-XML and Regulatory Review

Regulatory reviewers need to understand submitted datasets efficiently.

A submission that contains technically correct datasets but incomplete or inconsistent metadata creates unnecessary review burden.

Define-XML helps provide a standardized machine-readable description of the submission.

Important: Define-XML quality is not merely a cosmetic concern. Metadata errors can make otherwise correct datasets harder to interpret, trace, validate, or review.

Common Define-XML Problems

  1. Dataset exists but is missing from Define-XML. Every submitted dataset needs appropriate metadata representation.
  2. Variable exists in the dataset but not in Define-XML. The dataset and metadata are inconsistent.
  3. Variable is described with the wrong label. This can lead to reviewer confusion.
  4. Incorrect data type. The metadata does not accurately represent the dataset.
  5. Incorrect variable length or significant digits. The metadata does not accurately describe the stored data.
  6. Missing codelist. A controlled variable lacks the expected terminology metadata.
  7. Incorrect codelist. The variable is linked to terminology that does not match the data.
  8. Missing origin. The reviewer cannot easily determine where the variable came from.
  9. Missing computational method. A derived variable lacks adequate derivation metadata.
  10. Missing value-level metadata. A variable with parameter-dependent meaning is described too generically.
  11. Broken references. An OID or document reference points to something that does not exist.
  12. Metadata describes an older dataset version. The Define-XML no longer matches the final submission datasets.

Define-XML Validation

Validation should occur at multiple levels.

Validation Type Question
XML validation Is the XML structurally valid?
Schema validation Does the document conform to the applicable Define-XML schema?
Dataset comparison Does Define-XML match the submitted datasets?
Terminology validation Are codelists and codes represented correctly?
Traceability review Can derived variables be understood and traced?
Regulatory review Does the submission meet applicable agency expectations?

Dataset-to-Define Reconciliation

One of the most important QC checks is comparing the actual dataset metadata against Define-XML.

For every dataset:

1
Confirm the dataset exists.
2
Confirm the dataset name is correct.
3
Compare variable counts.
4
Compare variable names.
5
Compare variable order.
6
Compare labels.
7
Compare data types and applicable lengths or precision metadata.
8
Verify codelists.
9
Verify methods and origins.
10
Investigate every discrepancy.

Example of a Metadata Mismatch

Suppose the dataset contains:

AGE
integer

but Define-XML states:

AGE
float

The dataset may still contain values that appear correct.

Nevertheless, the metadata is inconsistent.

The Define-XML should accurately describe the submitted dataset.

Another Metadata Mismatch

Suppose the dataset contains:

TRT01P
"Drug A"
"Placebo"

but the Define-XML links the variable to an unrelated codelist.

The data and metadata are no longer semantically aligned.

This type of error is particularly important because it can be less obvious than a simple missing variable.

Value-Level Metadata QC

Value-level metadata deserves special attention.

For every VLM definition, verify:

  • The parent variable exists.
  • The where-clause variable exists.
  • The where-clause value is valid.
  • The parameter-specific label is correct.
  • The parameter-specific unit is correct.
  • The parameter-specific origin is correct.
  • The parameter-specific method is correct.

Methods QC

For each computational method:

  • Confirm the method identifier is unique.
  • Confirm the method is referenced correctly.
  • Confirm the description matches the actual derivation.
  • Confirm the referenced documentation exists.
  • Confirm the method has not been copied from an outdated version.

Document Reference QC

Document references can fail even when the underlying XML is technically valid.

Check:

  • Document filename
  • Document path
  • Leaf identifier
  • Document version
  • Referenced page or section where applicable
  • Actual availability of the referenced document

Define-XML Versus a Data Dictionary

A data dictionary and Define-XML are related but not identical.

Feature Data Dictionary Define-XML
Human-readable Yes Yes, when rendered
Machine-readable Usually limited Yes
Dataset metadata Yes Yes
Variable metadata Yes Yes
Codelists Possible Structured
Value-level metadata Possible Structured
Computational methods Possible Structured
XML relationships No Yes

A spreadsheet may be an excellent source for maintaining metadata, but it is not itself Define-XML.

Define-XML Versus Dataset-XML

These two names are easy to confuse.

They serve different purposes.

Define-XML Dataset-XML
Primary purpose Describe dataset metadata Represent dataset data in XML
Contains observations Generally no Yes
Contains variable metadata Yes Not its primary purpose
Contains codelists Yes Not its primary purpose

The distinction is important when working with electronic submissions.

Define-XML and XPT Files

Traditional regulatory submissions often include SAS transport-format datasets alongside Define-XML metadata.

The relationship is conceptually:

$$ \text{XPT Dataset} \leftrightarrow \text{Define-XML Metadata} $$

The XPT file contains the actual data.

Define-XML describes the structure and meaning of the data.

Why Define-XML Errors Are Dangerous

Suppose the underlying data are correct but Define-XML incorrectly describes the variable.

A reviewer may interpret the data incorrectly.

Alternatively, suppose the Define-XML says a variable is derived using a particular method, but the production program used another method.

The metadata no longer accurately represents the submitted data-generation process.

Metadata must describe reality. A perfectly formatted Define-XML file is not useful if the metadata inside it does not accurately describe the datasets.

Define-XML as a Contract

A useful mental model is to think of Define-XML as a metadata contract.

It establishes expectations about:

  • What datasets exist
  • What variables exist
  • What variables mean
  • What values are permitted
  • Where values came from
  • How values were derived
  • Which documents support the definitions

The actual datasets should satisfy that contract.

Define-XML and Automation

Modern clinical programming organizations often automate Define-XML generation.

A metadata repository may contain:

Dataset metadata
Variable metadata
Codelists
Origins
Methods
Value-level metadata
Document references

A generation engine can then produce:

define.xml

This approach provides important advantages.

Benefits of Automated Define-XML Generation

  • Reduced manual XML editing
  • Improved reproducibility
  • Consistent naming conventions
  • Automated OID generation
  • Automated dataset reconciliation
  • Reusable programming components
  • Easier updates when datasets change
  • Better auditability

Metadata-Driven Development

An advanced clinical programming workflow can treat metadata as a central development artifact.

A
Specification: define dataset and variable requirements.
B
Programming: create the datasets.
C
Metadata: capture the final dataset definitions.
D
Generation: produce Define-XML automatically.
E
Validation: compare metadata with final datasets.

Define-XML Quality-Control Checklist

Check Question
Dataset coverage Is every submitted dataset represented?
Variable coverage Is every submitted variable represented?
Variable order Does metadata reflect the intended dataset structure?
Labels Are labels accurate?
Data types Do types match the datasets?
Codelists Are controlled terms correctly associated?
Origins Are origins accurately documented?
Methods Are derived variables adequately described?
VLM Is value-level metadata complete where needed?
References Do document references resolve correctly?
OIDs Are metadata identifiers unique and consistently referenced?
Schema Does the XML conform to the applicable schema?

Common Beginner Mistakes

  1. Thinking Define-XML contains the clinical data. It describes the data rather than replacing the submitted datasets.
  2. Treating Define-XML as a simple spreadsheet export. Define-XML represents relationships between metadata objects that a simple variable listing does not capture.
  3. Ignoring value-level metadata. Some variables require conditional metadata based on parameter or another qualifying variable.
  4. Forgetting origins. A reviewer should be able to understand where variables came from.
  5. Documenting derivations inaccurately. The metadata must correspond to the actual production derivation.
  6. Using stale metadata. Define-XML should describe the final submitted datasets.
  7. Manually editing generated XML without reconciliation. Manual changes can easily introduce inconsistencies.
  8. Validating only the XML syntax. Well-formed XML can still contain incorrect clinical metadata.
  9. Assuming a successful schema validation means the metadata is correct. Schema validity does not guarantee semantic correctness.

Well-Formed XML vs. Correct Define-XML

These are different concepts.

An XML document can be syntactically well-formed while containing incorrect metadata.

For example:

<ItemDef
    Name="AGE"
    DataType="integer">
</ItemDef>

The XML may be syntactically valid.

But if the actual submitted variable is character data, the metadata is wrong.

Three levels of quality matter: XML syntax, schema conformance, and semantic correctness. A high-quality Define-XML implementation must address all three.

Semantic Validation

Semantic validation asks whether the metadata actually makes sense.

Examples:

  • Does SEX use an appropriate sex terminology codelist?
  • Does AGE have the appropriate data type?
  • Does CHG have a method consistent with the actual program?
  • Does AVAL have appropriate value-level metadata?
  • Does the dataset structure match the stated structure?

Independent Define-XML QC

For important regulatory submissions, independent QC is valuable.

One approach is:

1
Production programmer generates Define-XML.
2
QC programmer independently reconstructs key metadata checks.
3
Automated validation is executed.
4
Differences are investigated.
5
Final Define-XML is reconciled against the submission package.

Final Submission Reconciliation

The final Define-XML should be generated or finalized against the actual submission datasets.

Do not generate Define-XML against an intermediate programming version and assume the final datasets will remain unchanged.

A final reconciliation should confirm:

  • Dataset names
  • Dataset files
  • Variable names
  • Variable order
  • Labels
  • Types
  • Lengths
  • Codelists
  • Methods
  • Origins
  • Value-level metadata
  • Document references

Define-XML and Reviewer Experience

Good metadata has a practical effect on the review process.

A reviewer should be able to move from:

$$ \text{Dataset} \rightarrow \text{Variable} \rightarrow \text{Meaning} \rightarrow \text{Origin} \rightarrow \text{Derivation} $$

without encountering unexplained gaps.

This is one of the fundamental reasons Define-XML matters.

A Practical Example

Suppose an ADaM efficacy dataset contains:

USUBJID
PARAMCD
PARAM
AVAL
BASE
CHG
PCHG
AVISIT
ANL01FL

A reviewer might want to know:

  • What is PARAMCD?
  • What does AVAL represent for each parameter?
  • How is BASE selected?
  • How is CHG calculated?
  • How is PCHG calculated?
  • What does ANL01FL identify?

Define-XML can provide metadata for each of these concepts.

Example Derivation Chain

Variable Example Metadata Question
BASE 120 How was baseline selected?
AVAL 108 What does the analysis value represent?
CHG −12 How was change calculated?
PCHG −10% How was percentage change calculated?
ANL01FL Y What qualifies a record for the analysis?

The metadata is therefore closely connected to the statistical programming logic.

Define-XML and Traceability to Programs

Define-XML does not mean that every line of SAS or R code must be embedded in the XML.

Instead, the metadata should communicate the derivation sufficiently and link to supporting documentation where appropriate.

The detailed programming implementation remains in the validated analysis programs and supporting documentation.

What Makes a Good Define-XML Document?

A high-quality Define-XML document should be:

  • Complete: all required datasets and metadata are represented.
  • Accurate: metadata matches the actual submission.
  • Consistent: terminology and identifiers are used coherently.
  • Traceable: important derived information can be understood.
  • Machine-readable: the XML conforms to the applicable standard.
  • Reviewable: a human reviewer can understand the submission.
  • Reproducible: the document can be regenerated or maintained reliably.

The Most Important Mental Model

The easiest way to understand Define-XML is to think in layers.

1
Data: What values were submitted?
2
Structure: How are those values organized into datasets and variables?
3
Semantics: What does each variable mean?
4
Terminology: What do the coded values mean?
5
Origin: Where did the values come from?
6
Derivation: How were derived values calculated?
7
Documentation: Where can supporting information be found?

Define-XML in the Clinical Programming Lifecycle

Define-XML should not be viewed as something that appears only during the final week of a submission.

Instead, it connects several stages of clinical programming.

$$ \text{Specification} \rightarrow \text{Programming} \rightarrow \text{Metadata} \rightarrow \text{Define-XML} \rightarrow \text{Validation} \rightarrow \text{Submission} $$

The earlier metadata is maintained accurately, the easier the final Define-XML generation and validation become.

Practical Define-XML Checklist

1
Confirm the Define-XML version.
2
Inventory all final submission datasets.
3
Reconcile dataset names.
4
Reconcile variable names and order.
5
Reconcile labels and data types.
6
Review codelists and controlled terminology.
7
Review origins.
8
Review computational methods.
9
Review value-level metadata.
10
Validate XML structure and schema conformance.
11
Perform semantic metadata validation.
12
Perform final submission reconciliation.

Key Differences: Define-XML vs. Dataset Content

Question Dataset Define-XML
What is the subject's AGE? Contains the value Describes AGE
What does AGE mean? Not necessarily Yes
What values are allowed for SEX? Contains observed values Can describe controlled terminology
How was CHG derived? Contains the result Can describe the derivation method
Where did a variable originate? Not necessarily Yes
What supporting document applies? Not necessarily Can provide document references

The Bottom Line

Define-XML is much more than an electronic data dictionary.

It is a structured metadata representation that connects the submitted datasets to the information needed to understand them.

For clinical programmers, this means Define-XML sits at the intersection of:

  • Dataset programming
  • CDISC standards
  • Controlled terminology
  • Metadata management
  • Derivation documentation
  • Traceability
  • Quality control
  • Regulatory submission
Bottom line: Define-XML describes the structure and meaning of clinical-trial datasets in a machine-readable form. It identifies datasets and variables, describes controlled terminology, documents origins and computational methods, supports value-level metadata, and connects metadata to supporting documents. Its importance comes from the fact that regulatory review depends not only on having the correct data, but also on making those data understandable, traceable, and consistently described.

References

CDISC. Define-XML. CDISC standards documentation and implementation resources.

CDISC. Define-XML 2.0 Specification. Clinical Data Interchange Standards Consortium.

CDISC. Define-XML 2.1 Specification. Clinical Data Interchange Standards Consortium.

CDISC. SDTM Implementation Guide. Clinical Data Interchange Standards Consortium.

CDISC. ADaM Implementation Guide. Clinical Data Interchange Standards Consortium.

U.S. Food and Drug Administration. Study Data Technical Conformance Guide. Guidance for submitting standardized study data and associated metadata.