Transpose Data -- Restructure using a BY variable
Step 1. Open the data set Complications
This data set contains complications observed on accident victims. Notice that some victims (such as1921 and 2076) have more than one complication. You can use the transpose procedure to expand a single subject's information to include other observations for a selected variable.
Step 2. You must make sure that the data are sorted on the key (ID, Subject, etc) variable. In this case, sort ascending on the SUBJECT variable by selecting Edit/Sort Ascending.
Step 3. Select Edit Transpose data, Restructure data by key variable. Select SUBJECT as the "BY" variable and COMPLICATION as the variable to expand as shown in the following dialog box. Click Ok.
Step 4. You will be asked if you want to replace the data currently in the data grid with the revised data set. (If you have not previously saved the data, do so before doing the transpose.) Answer Ok to continue. You may also be prompted to enter a missing value code (enter blank for this example). The following data set is displayed.
(In attributes change the decimals for subject to 0.)
Note that the variable COMPLICATION was expanded (renamed VAR001, VAR002, etc). Subject 1921 is shown to have Pneumonia and Renal Failure. At least one subject had 7 complications, so the new data set has columns defined up to VAR007. Save this data set to capture these changes.
- End of Tutorial-