Preparing the Data
The dataset contains the dates of release from first arrest and second arrest; since Cox regression analyzes survival times, you need to compute the amount of time between these dates.
However, Date of second arrest [date2] contains cases with the value 10/03/1582, a missing value for date variables. These are people who have not had a second offense, and we definitely want to include them as right-censored cases in the model. The end of the follow-up period was June 30, 2006, so we are going to recode 10/03/1582 to 06/30/2006.
- To recode these values, from the menus choose:
Figure 1. Compute Variable dialog box - In the Compute Variable dialog, type date2 as the target variable.
- Type DATE.DMY(30,6,2006) as the expression.
- Click If.
Figure 2. Compute Variable If Cases dialog box - In the If Cases dialog, select Include if case satisfies condition.
- Type MISSING(date2) as the expression.
- Click Continue.
- Click OK in the Compute Variable dialog box.
- Next, to compute the time
between first and second arrest, from the menus choose:
Figure 3. Date and Time Wizard, Welcome step - In the Welcome step, select Calculate with dates and times.
- Click Next.
Figure 4. Date and Time Wizard, Do Calculations on Dates step - In step 1, select Calculate the number of time units between two dates.
- Click Next.
Figure 5. Date and Time Wizard, Calculate the number of time units between two dates step - In step 2, select Date of second arrest [date2] as the first date.
- Select Date of release from first arrest [date1] as the date to subtract from the first date.
- Select Days as the unit.
- Click Next.
Figure 6. Date and Time Wizard, Calculation step - In step 3, type time_to_event in the Result Variable field.
- Type Time to second arrest as the variable label.
- Click Finish.