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.

  1. To recode these values, from the menus choose:

    Transform > Compute Variable...

    Figure 1. Compute Variable dialog box
    Compute Variable dialog box
  2. In the Compute Variable dialog, type date2 as the target variable.
  3. Type DATE.DMY(30,6,2006) as the expression.
  4. Click If.
    Figure 2. Compute Variable If Cases dialog box
    Compute Variable If Cases dialog box
  5. In the If Cases dialog, select Include if case satisfies condition.
  6. Type MISSING(date2) as the expression.
  7. Click Continue.
  8. Click OK in the Compute Variable dialog box.
  9. Next, to compute the time between first and second arrest, from the menus choose:

    Transform > Date and Time Wizard...

    Figure 3. Date and Time Wizard, Welcome step
    Date and Time Wizard, Welcome step
  10. In the Welcome step, select Calculate with dates and times.
  11. Click Next.
    Figure 4. Date and Time Wizard, Do Calculations on Dates step
    Date and Time Wizard, Do Calculations on Dates step
  12. In step 1, select Calculate the number of time units between two dates.
  13. Click Next.
    Figure 5. Date and Time Wizard, Calculate the number of time units between two dates step
    Date and Time Wizard, Calculate the number of time units between two dates step
  14. In step 2, select Date of second arrest [date2] as the first date.
  15. Select Date of release from first arrest [date1] as the date to subtract from the first date.
  16. Select Days as the unit.
  17. Click Next.
    Figure 6. Date and Time Wizard, Calculation step
    Date and Time Wizard, Calculation step
  18. In step 3, type time_to_event in the Result Variable field.
  19. Type Time to second arrest as the variable label.
  20. Click Finish.

Next