Introduction
This article describes how to cut study SDTM data using a modular approach to enable any further study or project specific customization.
Programming Flow
- Read in Data
- Create DCUT Dataset
- Preprocess Datasets
- Specify Cut Types
- Patient Cut
- Date Cut
- DM Cut
- Apply Cut
- Output Final List of Cut Datasets
Create DCUT Dataset
The next step is to create the DCUT dataset containing the datacut date and description.
dcut <- create_dcut(
dataset_ds = source_data$ds,
ds_date_var = DSSTDTC,
filter = DSDECOD == "RANDOMIZATION",
cut_date = "2022-06-04",
cut_description = "Clinical Cutoff Date"
)
Preprocess Datasets
If any pre-processing of datasets is needed, for example in the case of FA, where there are multiple date variables, this should be done next.
source_data$fa <- source_data$fa %>%
mutate(DCUT_TEMP_FAXDTC = case_when(
FASTDTC != "" ~ FASTDTC,
FADTC != "" ~ FADTC,
TRUE ~ as.character(NA)
))
Specify Cut Types
We’ll next specify the cut types for each dataset (patient cut, date cut or no cut) and in the case of date cut which date variable should be used.
Patient Cut
Next we’ll apply the patient cut.
patient_cut_data <- lapply(
source_data[patient_cut_list], pt_cut,
dataset_cut = dcut
)
This adds on temporary flag variables indicating which observations will be removed, for example for SC:
Date Cut
Next we’ll apply the date cut.
date_cut_data <- pmap(
.l = list(
dataset_sdtm = source_data[date_cut_list[, 1]],
sdtm_date_var = syms(date_cut_list[, 2])
),
.f = date_cut,
dataset_cut = dcut,
cut_var = DCUTDTM
)
This again adds on temporary flag variables indicating which observations will be removed, for example for AE:
DM Cut
Then lastly we’ll apply the special DM cut which also updates the death related variables.
dm_cut <- special_dm_cut(
dataset_dm = source_data$dm,
dataset_cut = dcut,
cut_var = DCUTDTM
)
This adds on temporary variables indicating any death records that would change as a result of applying a datacut: