Survival Analysis Variables
Description
Use a calculated variable to return the count of days between the baseline date and the date of an event of interest.
How To
Note: Survival analyses require two variables: 1) whether or not it is a "Censored" event, and 2) the length of time to the event of interest.
Censored Event:
Select the event date (e.g., death) and use the following function:
function main(deathDate) {
 if (isNull(deathDate)) {
   return 0;
 }
 return 1;
}
Â
Length of Time to Event:
Select the event date (e.g., death), baseline date and the last available encounter date (all encounter dates are needed, unless using an "Output Interval" containing the baseline and last follow-up).
Â
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.....
}
Note the image below uses VBScript, but above code uses JavaScript (recommended)
Â
Â
Â
Â