Restructure Data Wizard (Cases to Variables): Options
In this step, specify options for the new, restructured file.
How should the new variable groups be ordered in the new file?
- By variable. The wizard groups the new variables created from an original variable together.
- By index. The wizard groups the variables according to the values of the index variables.
Example. The variables to be restructured are w and h, and the index is month:
w, h, month
Grouping by variable results in:
w.jan, w.feb, h.jan
Grouping by index results in:
w.jan, h.jan, w.feb
Create a count variable? The wizard can create a count variable in the new file. It contains the number of rows in the current data that were used to create a row in the new data file.
Create indicator variables? The wizard can use the index variables to create indicator variables in the new data file. It creates one new variable for each unique value of the index variable. The indicator variables signal the presence or absence of a value for a case. An indicator variable has the value of 1 if the case has a value; otherwise, it is 0.
Example. The index variable is product. It records the products that a customer purchased. The original data are:
customer | product |
---|---|
1 | chick |
1 | eggs |
2 | eggs |
3 | chick |
Creating an indicator variable results in one new variable for each unique value of product. The restructured data are:
customer | indchick | indeggs |
---|---|---|
1 | 1 | 1 |
2 | 0 | 1 |
3 | 1 | 0 |
In this example, the restructured data could be used to get frequency counts of the products that customers buy.