Preparing the Data for Analysis
Before restructuring the data, you will need to create two ancillary variables to help with the restructuring.
- To compute a new variable, from the menus choose:
Figure 1. Compute Variable dialog box - In the Compute Variable dialog, type start_time2 as the target variable.
- Type time1 as the numeric expression.
- Click OK.
- Recall the Compute Variable dialog box.
- Type start_time3 as the target variable.
- Type time2 as the numeric expression.
- Click OK.
- To restructure the data from variables to
cases, from the menus choose:
Figure 2. Restructure Data Wizard, Welcome step - In the Welcome step, make sure Restructure selected variables into cases is selected.
- Click Next.
Figure 3. Restructure Data Wizard, Variables to Cases Number of Variable Groups step - In step 2, select More than one variable group to restructure.
- Type 6 as the number of groups.
- Click Next.
Figure 4. Restructure Data Wizard, Variables to Cases Select Variables step - In the Case Group Identification group, select Use selected variable and select Patient ID [patid] as the subject identifier.
- Type event as the first target variable.
- Select First event post-attack [event1], Second event post-attack [event2], and Third event post-attack [event3] as variables to be transposed.
- Select trans2 from the target variable list.
Figure 5. Restructure Data Wizard, Variables to Cases Select Variables step - Type start_time as the target variable.
- 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.
- Select trans3 from
the target variable list.
Figure 6. Restructure Data Wizard, Variables to Cases Select Variables step - Type time_to_event as the target variable.
- 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.
- Select trans4 from the target variable list.
Figure 7. Restructure Data Wizard, Variables to Cases Select Variables step - Type mi as the target variable.
- Select History of myocardial infarction [mi], History of myocardial infarction [mi1], and History of myocardial infarction [mi2] as variables to be transposed.
- Select trans5 from the target variable list.
Figure 8. Restructure Data Wizard, Variables to Cases Select Variables step - Type is as the target variable.
- Select History of ischemic stroke [is], History of ischemic stroke [is1], and History of ischemic stroke [is2] as variables to be transposed.
- Select trans6 from
the target variable list.
Figure 9. Restructure Data Wizard, Variables to Cases Select Variables step - Type hs as the target variable.
- Select History of hemorrhagic stroke [hs], History of hemorrhagic stroke [hs1], and History of hemorrhagic stroke [hs2] as variables to be transposed.
- Click Next, then click Next in the Create Index Variables step.
Figure 10. Restructure Data Wizard, Variables to Cases Create One Index Variable step - In step 5, type event_index as the name of the index variable and type Event index as the variable label.
- Click Next.
Figure 11. Restructure Data Wizard, Variables to Cases Create One Index Variable step - In step 6, make sure Keep and treat as fixed variable(s) is selected.
- 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.
- To filter these cases, from the menus choose:
Figure 12. Select Cases dialog box - In the Select Cases dialog, select If condition is satisfied.
- Click If.
Figure 13. Select Cases If dialog box - In the Select Cases If dialog, type event >= 0 as the conditional expression.
- Click Continue.
- In the Select Cases dialog, select Delete unselected cases.
- Click OK.