This script illustrates the use of the GLM procedure to analyze data where subjects are measured repeatedly (time factor) on multiple response variables. It demonstrates the use of the REPEATED statement to define within-subject factors (Response and Time) and the alternative with the MANOVA statement to specifically test the main effects of time via contrasts.
Data Analysis
Type : CREATION_INTERNE
Data is created via a DATA step 'Trial' using datalines included in the script.
1 Code Block
DATA STEP Data
Explanation : Creation of the 'Trial' dataset containing treatments and repeated measurements (Pre, Post, Follow) for two response variables (Y1, Y2).
Copied!
data Trial;
input Treatment $ Repetition PreY1 PostY1 FollowY1
PreY2 PostY2 FollowY2;
datalines;
A 1 3 13 9 0 0 9
A 2 0 14 10 6 6 3
A 3 4 6 17 8 2 6
A 4 7 7 13 7 6 4
A 5 3 12 11 6 12 6
A 6 10 14 8 13 3 8
B 1 9 11 17 8 11 27
B 2 4 16 13 9 3 26
B 3 8 10 9 12 0 18
B 4 5 9 13 3 0 14
B 5 0 15 11 3 0 25
B 6 4 11 14 4 2 9
Control 1 10 12 15 4 3 7
Control 2 2 8 12 8 7 20
Control 3 4 9 10 2 0 10
Control 4 10 8 8 5 8 14
Control 5 11 11 11 1 0 11
Control 6 1 5 15 8 9 10
;
Explanation : Execution of PROC GLM with the REPEATED statement to analyze within-subject factors. 'Response' has 2 levels (Y1, Y2) and 'Time' has 3 levels (Pre, Post, Follow). The 'nouni' option suppresses individual univariate analyses.
Copied!
proc glm data=Trial;
class Treatment;
model PreY1 PostY1 FollowY1
PreY2 PostY2 FollowY2 = Treatment / nouni;
repeated Response 2 identity, Time 3;
run;
1
PROC GLMDATA=Trial;
2
class Treatment;
3
model PreY1 PostY1 FollowY1
4
PreY2 PostY2 FollowY2 = Treatment / nouni;
5
repeated Response 2 identity, Time 3;
6
RUN;
3 Code Block
PROC GLM
Explanation : Use of the MANOVA statement to test the main effect of time globally (Intercept in the transformed M space). M transformations calculate differences between times for each response variable.
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.