Preparing the Data for Analysis

Before restructuring the data, you will need to create two ancillary variables to help with the restructuring.

  1. To compute a new variable, from the menus choose:

    Transform > Compute Variable...

    Figure 1. Compute Variable dialog box
    Compute Variable dialog box
  2. In the Compute Variable dialog, type start_time2 as the target variable.
  3. Type time1 as the numeric expression.
  4. Click OK.
  5. Recall the Compute Variable dialog box.
  6. Type start_time3 as the target variable.
  7. Type time2 as the numeric expression.
  8. Click OK.
  9. To restructure the data from variables to cases, from the menus choose:

    Data > Restructure...

    Figure 2. Restructure Data Wizard, Welcome step
    Restructure Data Wizard, Welcome step
  10. In the Welcome step, make sure Restructure selected variables into cases is selected.
  11. Click Next.
    Figure 3. Restructure Data Wizard, Variables to Cases Number of Variable Groups step
    Restructure Data Wizard, Variables to Cases Number of Variable Groups step
  12. In step 2, select More than one variable group to restructure.
  13. Type 6 as the number of groups.
  14. Click Next.
    Figure 4. Restructure Data Wizard, Variables to Cases Select Variables step
    Restructure Data Wizard, Variables to Cases Select Variables step
  15. In the Case Group Identification group, select Use selected variable and select Patient ID [patid] as the subject identifier.
  16. Type event as the first target variable.
  17. Select First event post-attack [event1], Second event post-attack [event2], and Third event post-attack [event3] as variables to be transposed.
  18. Select trans2 from the target variable list.
    Figure 5. Restructure Data Wizard, Variables to Cases Select Variables step
    Restructure Data Wizard, Variables to Cases Select Variables step
  19. Type start_time as the target variable.
  20. Select Length of stay for rehabilitation [los_rehab], start_time2, and start_time3 as variables to be transposed. Time to first event post-attack [time1] and Time to second event post-attack [time2] will be used to create the end times, and each variable can only appear in one list of variables to be transposed, thus start_time2 and start_time3 were necessary.
  21. Select trans3 from the target variable list.
    Figure 6. Restructure Data Wizard, Variables to Cases Select Variables step
    Restructure Data Wizard, Variables to Cases Select Variables step
  22. Type time_to_event as the target variable.
  23. Select Time to first event post-attack [time1], Time to second event post-attack [time2], and Time to third event post-attack [time3] as variables to be transposed.
  24. Select trans4 from the target variable list.
    Figure 7. Restructure Data Wizard, Variables to Cases Select Variables step
    Restructure Data Wizard, Variables to Cases Select Variables step
  25. Type mi as the target variable.
  26. Select History of myocardial infarction [mi], History of myocardial infarction [mi1], and History of myocardial infarction [mi2] as variables to be transposed.
  27. Select trans5 from the target variable list.
    Figure 8. Restructure Data Wizard, Variables to Cases Select Variables step
    Restructure Data Wizard, Variables to Cases Select Variables step
  28. Type is as the target variable.
  29. Select History of ischemic stroke [is], History of ischemic stroke [is1], and History of ischemic stroke [is2] as variables to be transposed.
  30. Select trans6 from the target variable list.
    Figure 9. Restructure Data Wizard, Variables to Cases Select Variables step
    Restructure Data Wizard, Variables to Cases Select Variables step
  31. Type hs as the target variable.
  32. Select History of hemorrhagic stroke [hs], History of hemorrhagic stroke [hs1], and History of hemorrhagic stroke [hs2] as variables to be transposed.
  33. Click Next, then click Next in the Create Index Variables step.
    Figure 10. Restructure Data Wizard, Variables to Cases Create One Index Variable step
    Restructure Data Wizard, Variables to Cases Create One Index Variable step
  34. In step 5, type event_index as the name of the index variable and type Event index as the variable label.
  35. Click Next.
    Figure 11. Restructure Data Wizard, Variables to Cases Create One Index Variable step
    Restructure Data Wizard, Variables to Cases Create One Index Variable step
  36. In step 6, make sure Keep and treat as fixed variable(s) is selected.
  37. Click Finish.
    Table 1. Restructured data
    event_index event start_time time_to_event mi is hs
    1 0 3 1500 0 1 0
    2 -4 1500 -4 -4 -4 -4
    3 -4 . -4 -4 -4 -4
    1 1 33 1311 0 1 0
    2 4 1311 1325 1 1 0
    3 -3 1325 -3 -3 -3 -3
    1 4 12 1098 1 1 0
    2 -3 1098 -3 -3 -3 -3
    3 -3 . -3 -3 -3 -3

    The restructured data contains three cases for every patient; however, many patients experienced fewer than three events, so there are many cases with negative (missing) values for event. You can simply filter these from the dataset.

  38. To filter these cases, from the menus choose:

    Data > Select Cases...

    Figure 12. Select Cases dialog box
    Select Cases dialog box
  39. In the Select Cases dialog, select If condition is satisfied.
  40. Click If.
    Figure 13. Select Cases If dialog box
    Select Cases If dialog box
  41. In the Select Cases If dialog, type event >= 0 as the conditional expression.
  42. Click Continue.
  43. In the Select Cases dialog, select Delete unselected cases.
  44. Click OK.

Next