I have a one-factor repeated measures design; this works fine for the main effect:
proc glm;
class;
model Meana Meanb Meanc Meand Meane Meanf Meang Meanh= /nouni;
repeated Segment 8;
run;
I have tried every syntax I could think of to carry out contrasts comparing level 1 to 5, and level 3 to 7, but none produces any contrast output. Here is one example of my statements (yes, I have tried putting the contrast statement before the repeated statement):
proc glm;
class;
model Meana Meanb Meanc Meand Meane Meanf Meang Meanh= /nouni;
repeated Segment 8;
contrast '1 v. 5' 1 0 0 0 -1 0 0 0, '3 v. 7' 0 0 1 0 0 0 -1 0;
run;
If you are going to use PROC GLM, the CONTRAST transformation on the REPEATED statement generates contrasts between levels of the factor and a reference level. By default, the procedure uses the last level as the reference level; you can optionally specify a reference level in parentheses after the keyword CONTRAST. You will need to add the SUMMARY option to the REPEATED statement that will provide the respective results. For example,
repeated segment 8 / summary;
You would have results for 7 contrasts comparing each segment to segment 8. The results are shown under Contrast_Variable: Segment 1, Contrast_Variable: Segment 2,...Contrast_Variable: Segment 7.
Note the PROC GLM documentation provides a Repeated Measures Example using Polynomial Transformation located that might be helpful resource. I would also recommend reviewing the REPEATED statement SYNTAX that provides additional information.
You can specify
repeated segment 5 / summary;
and that will provide segment 3 vs segment 5 comparison.
Another approach rather than using PROC GLM you might consider using PROC MIXED. You would need to restructure the data to univariate style, specify TYPE= covariance structure and then you can write specific CONTRASTS. Note most researchers use PROC MIXED rather than PROC GLM. The following paper
https://support.sas.com/rnd/app/stat/papers/mixedglm.pdf
provides an example of doing a repeated measures using PROC GLM and PROC MIXED.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.