Example of One Index for Variables to Cases
In the current data, there is one variable group, width, and one factor, time. Width was measured three times and recorded in w1, w2, and w3.
subject | w1 | w2 | w3 |
---|---|---|---|
1 | 6.7 | 4.3 | 5.7 |
2 | 7.1 | 5.9 | 5.6 |
We'll restructure the variable group into a single variable, width, and create a single numeric index. The new data are shown in the following table.
subject | index | width |
---|---|---|
1 | 1 | 6.7 |
1 | 2 | 4.3 |
1 | 3 | 5.7 |
2 | 1 | 7.1 |
2 | 2 | 5.9 |
2 | 3 | 5.6 |
Index starts with 1 and increments for each variable in the group. It restarts each time a new row is encountered in the original file. We can now use index in procedures that require a grouping variable.