library(dplyr)
library(haven)
library(SASxport)
sdtm_dm <- read_sas("C://dm.sas7bdat")
raw_dseos_001 <- read_sas("C://dseos_001.sas7bdat")
raw_visit_001 <- read_sas("C://visit_001.sas7bdat")
names(raw_dseos_001) <- toupper(names(raw_dseos_001))
names(raw_visit_001) <- toupper(names(raw_visit_001))
# Screen failure flag
sf <- raw_dseos_001 %>%
filter(DSDECOD_STD == "SCREEN FAILURE") %>%
mutate(
SUBJID = SUBJECT,
sfflag = "Y"
) %>%
select(SUBJID, sfflag)
# FU visit flag
fu <- raw_visit_001 %>%
filter(FOLDERNAME == "Follow-Up") %>%
mutate(
SUBJID = SUBJECT,
fuflag = "Y"
) %>%
select(SUBJID, fuflag)
# Merge DM with sf and fu flag dataset
sdtm_dm1 <- sdtm_dm %>