Multiple Numeric Indices (VARSTOCASES command)
Multiple numeric indices are used to identify groups of new rows that share a particular combination of factors. You can create multiple numeric indices if the original variables are ordered so that levels of a given factor are grouped together.
- The basic specification is
/INDEX=ivar(n) ivar(n) ...
, where ivar is the name of the new index for a factor and n is the number of factor levels represented in the variable group for which the index is being constructed. - The last index specified varies the fastest.
Example
B1 B2
A1 .00 .05
A2 5.00 3.00
- Data were collected for a designed experiment with
two levels of factor A and two levels of factor B. The table shows
the data for the first case.
caseid v_a1b1 v_a1b2 v_a2b1 v_a2b2 001 .00 .05 5.00 3.00
- The original data file is structured so that each
case has one variable for each combination of factors. Note that factor
B varies fastest.
VARSTOCASES /MAKE newvar FROM v_a1b1 TO v_a2b2 /INDEX=a(2) b(2).
caseid a b newvar 001 1 1 .00 001 1 2 .05 001 2 1 5.00 001 2 2 3.00
- The command restructures the data file and creates two indices, A and B.