Mixed Procedure


The MIXED procedure fits a variety of mixed linear models to data and enables you to use these fitted models to make statistical inferences about the data. The PROC MIXED was specifically designed to fit mixed effect models. It can model random and mixed effect data, repeated measures, etc.
Following code is an example for mixed procedure.


ods listing close;
proc mixed data=data;
    /*var1 and var2 are categorical variables*/
    class var1 var2; 
    /*for each id value the mixed procedure will be repeated*/
    by id; 
    /*Here var1, var2 and var3 are independent variables.*/
    model dependent= var1 var2 var3/ residual solution outp=predresid;
    /*variable for which to present the least square estimate and the control group*/
    lsmeans var1/ diff=control ("Group1");
    /*Here we fix the estimate required and also the significance level*/    
    estimate 'Group2-Group1' var1 -1 1/cl alpha=0.1; 
    /*Outputting the required into a SAS dataset*/    
    ods output diffs=lsdiff lsmeans=lsm;
ods listing;
You may also like: