This check looks for patients in DS who have a record indicating death but no corresponding record with death date in DS. For example, "Survival Follow Up" records often have no death dates, so for a data cut to be applied properly, you have to impute that missing death date from another record where its not missing (e.g. Study Discon form)

check_ds_dsdecod_dsstdtc(DS)

Arguments

DS

Disposition SDTMv dataset with variables USUBJID, DSDECOD, DSSCAT and DSSTDTC

Value

Boolean value for whether the check passed or failed, with 'msg' attribute if the test failed

Author

Will Harris

Examples


DS <- data.frame(STUDYID = rep(1, 5),
                 USUBJID = c(1, 1, 1, 2, 3),
                 DSDECOD = c("DEATH", "DEATH", rep("", 3)),
                 DSSCAT = LETTERS[1:5],
                 DSSTDTC = c("", "2016-01-01", "", "", "2016-01-02"),
                 stringsAsFactors = FALSE)

check_ds_dsdecod_dsstdtc(DS)
#> [1] TRUE

DS$DSSTDTC[2] <- ""

check_ds_dsdecod_dsstdtc(DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DS has death recorded with no death date records. "
#> attr(,"data")
#>   USUBJID DSDECOD DSSTDTC
#> 1       1   DEATH