Section 3: Data Structure for the Mixed Model Two different data structures are required for repeated measures data depending if you run the GLM procedure or the MIXED model approach. Understanding the difference between them and how to convert one structure to the other is an important step to clarify. File with a Wide Format The typical format for repeated measures data with the SAS or SPSS procedure called GLM is to construct a file with a wide or multivariate format. That is, enter all response variables from each subject into a dataset with variables names that denote the within-subject factors, such as specific times data were collected (if each person measured at the same time values). For three repeated observations all collected at three points in time, a wide or multivariate dataset looks like: id group time1 time2 time3 1 1 3 4 8 2 2 5 3 7 3 1 6 4 5 ... File with a Narrow Format However, a mixed model analysis requires these data be placed into a dataset with narrow or univariate structure. That is, one response variable is entered per row of the dataset indexed by time which for the above dataset is: id group time y 1 1 1 3 1 1 2 4 1 1 3 8 2 2 1 5 2 2 2 3 2 2 3 7 3 1 1 5 3 1 2 3 3 1 3 7 ... One of the many advantages of this data structure is it allows you to work with covariates that change over time also known as time-varying covariates. The multivariate data structure required for PROC GLM does not allow one to incorporate time varying covariates; that is, covariates can only assume different values between subjects, not within. PROC MIXED allows covariates to change because each repeated value is entered as a separate observation in the dataset. As a result PROC MIXED is able to compute repeated measures with changing covariate values and generate appropriately adjusted means. How to Transpose? Section 6.5 (Transpose Data) under Chapter 6 of the SAS documents demonstrates several methods by which SAS will convert data from a multivariate to a univariate format. You can find it at: http://www.uoregon.edu/~robinh/065appl_trnsp.txt SPSS Commands to Restructure a File For mixed model applications the restructuring process will take a specified list of variables and make them into one variable indexed by a new variable. The transposition process between univariate and multivariate structures can most easily be done with syntax commands (see the reference links below) or in recent versions with a "Restructure" option found under the Data window. However, for a dataset with many variables, the safest and most easily reproducible process of transposing data from multivariate to univariate format should be done through syntax commands that first read only the data you need to extract from the existing multivariate file and then restructure it: * select only the data you will work with for a new file. GET FILE= 'c:\spss\data\multv_dat.sav' / KEEP= id group height2 height4 height6 weight2 weight4 weight6 . * restructure the height and weight data into two variables (columns). VARSTOCASES / MAKE height FROM height2 height4 height6 / MAKE weight FROM weight2 weight4 weight6 / INDEX = time(3) / KEEP = id group / NULL = KEEP. The weight and height data should be placed in ascending order on the MAKE statements to reflect how they change with time. The index variable time begins with 1 and increases by 1 for each variable listed after FROM. An option also exists which places the respective variable name as the index value, which may be desirable if the within-subjects factor is unordered. However, to get a numerical value that represents the actual value of age for the two variables (e.g., 2, 4, 6 years) requires entering a computation: COMPUTE age= 2 + 2*(time -1). You can also enter the variable names as found in the multivariate structure (e.g., height2 height4 height6) as values of the index variable with a new name you specify (e.g., vr) with this INDEX command: / INDEX = vr(height) If you need to have two index variables to identify the levels of the values of the response (y1 y2 y3 y4) called vr1 and vr2, enter this INDEX command: / MAKE yy FROM y1 y2 y3 y4 / INDEX = vr1(2) vr2(2) Note the product of the numbers entered for the two index variables must equal the number of variables listed on the MAKE statement, e.g., 4 = 2x2. In the example above, the KEEP= statement specifies which variables in the file will be repeated across all levels of age. The NULL= keep implies the values of all remaining variables in the dataset will be repeated across all rows for each subject. With files that have many variables, this feature may greatly increase the size of the restructed dataset, perhaps making it very cumbersome to work with. As illustrated here with the GET FILE command, it is usually best to select only the variables you need from the original file in multivariate format, place them in a new file, and then restruction this latter one. Other types of commands to manipulate data structures (in both directions) with SPSS can be found at: http://www.uoregon.edu/~robinh/mult_to_univ_spss.txt http://www.uoregon.edu/~robinh/univ_to_mult_spss.txt