BookmarkSubscribeRSS Feed
montello
Calcite | Level 5

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;

4 REPLIES 4
STAT_Kathleen
SAS Employee

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.

montello
Calcite | Level 5
Thank you, I can get this to work, but it surprises me that I cannot
specify any contrast I want (such as level 3 vs. level 5). I did read all
about the REPEATED statement and its SYNTAX. Ciao.
Dan
STAT_Kathleen
SAS Employee

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.

 

 

montello
Calcite | Level 5
Actually, no that won't. These two versions produce exactly the same
output:

repeated segment 8/ summary;
repeated segment 5/ summary;

"restructure the data to univariate style"? This is but one of several
analyses I am doing. That seems like excessive trouble just to get simple
contrasts.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1474 views
  • 0 likes
  • 2 in conversation