Ben Z
Ben Z

Reputation: 105

How to add group code in pairwise comparison in SAS Proc mixed

When there are a lot of groups to compare, lsmeans/pdiff option gives too many pairwise comparisons. What I need is a table like

enter image description here

which shows that Group 1,2 are different from Group 5,6, but not different from Group 3,4.

Is there an option in SAS proc mixed or other procedures to do this?

Upvotes: 0

Views: 450

Answers (2)

data _null_
data _null_

Reputation: 9109

You are looking for the LINES option on the LSMEANS statement however it does not work in PROC MIXED so you will need to use PROC PLM.

proc mixed data=sashelp.class;
   class age;
   model weight=age;
   lsmeans age; *for check;
   store out=classmodel;
   run;
   quit;
proc plm restore=classmodel;
   lsmeans age / lines;
   run;
   quit;

enter image description here

Upvotes: 2

Richard
Richard

Reputation: 27498

Try using a custom format that is applied during the Proc.

proc format;
  value groupCat
    1 = 'A'
    2 = 'A'
    3 = 'AB'
    4 = 'AB'
    5 = 'B'
    6 = 'B'
  ;
run;

proc mixed …;
  … ;
  format group groupCat.;
  … 

Upvotes: 0

Related Questions