| |

Mixed models with SAS Enterprise Guide – Not Really

I was going to use SAS Enterprise Guide 4.3 with SAS On-Demand to do my mixed model analysis, but it did not quite work out.

First of all, if like me you are used to doing PROC GLM  where each subject is one record, you have to change your dataset to be one where each score has one record. You can do this in SAS Enterprise Guide using the Query Builder Task but I frankly find this more trouble than it’s worth. Right click on your dataset and from the drop down menu select “PROPERTIES”. This will give you the dataset name SAS has assigned to your data set. Use that name in your SET statement. The code below creates two data sets named pretest and posttest. It renames the pretest and posttest scores to the same variable “testscore”

data pretest ;
rename pretotal = testscore ;
testtype = “pre-test” ;
data posttest ;
rename posttotal = testscore ;
testtype = “posttest” ;

This concatenates the two data sets to make one.
data matched ;
set pretest posttest ;
run ;

For some reason, I could not get the SAS Enterprise Guide windows to let me do the nested effect, so I finally gave up (okay, I spent about 10 minutes trying, because I was busy) and coded it like this:

proc mixed data= matched  ;
class group testtype  username ;
model testscore = group testtype group*testtype / ddfm = kr ;
repeated testtype / type = un subject= username(group) ;

This identifies three variables, group (control or experimental), testtype (pre or post) and username as categorical.

The dependent variable is testscore and I wanted to test for main effects of testtype,  group and an interaction effect of testtype and group. I requested the Kenward Rogers method of calculating the degrees of freedom.

Testtype is a repeated effect.  My subjects are identified by username and usernames are nested within groups, that is, each of the users was in either the experimental or control group.


Here are the results. mixedeffect

Group = the students  who played our math game or not (check it out here, it’s cool). Testtype is, obviously, pre or post, and you can see that there is a significant difference, even with the modest number of subjects in our pilot study.

Honestly, looking at how short the code really is and thinking about how much faster the SAS Web Editor is and the fact it works on the Mac as well as PC, I’m thinking it may not be worth the trouble of using Enterprise Guide. In this case it certainly wasn’t, since all I did was open the PROGRAM window and type.







Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *