Survival analyses require two variable: 1) whether or not it is a "Censored" event, and 2) the length of time to the event of interest.
Censored Event
Choose the event date (e.g., death) and using the following function
function main() {
if (isNull(V1)) {
return 0;
}
return 1;
}
Length of Time to Event
Choose the event date (e.g., death), baseline date and the last available encounter date.
function getLength() {
if isNull(baselineDate) {
return null;
} else if (!isNull(deathDate) {
return days between Baseline and Death;
} else if (longestEncounterDate) {
return days between Baseline and longestEncounterDate;
} else if (SecondLongestEncounterDate) {
return days between Baseline and SecondLongestEncounterDate
} etc.....
}