1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;5556 /* RepeatedMonkey.sas */57 title 'Primate hippocampal function: Zola-Morgan and Squire, 1990';58 title2 'Covariance Structure approach to repeated measures (within-cases)';5960 data memory;61 infile '/folders/myfolders/monkey.data.txt' firstobs=2;62 input monkey $ treatment $ week2 week4 week8 week12 week16;63 /* Make 5 "cases" in the data set for each line in the raw data file.64 The output command generates a case. */65 id = _n_;66 time = 2; score = week2; output;67 time = 4; score = week4; output;68 time = 8; score = week8; output;69 time = 12; score = week12; output;70 time = 16; score = week16; output;71 keep monkey treatment id time score;72NOTE: The infile '/folders/myfolders/monkey.data.txt' is:Filename=/folders/myfolders/monkey.data.txt,Owner Name=root,Group Name=vboxsf,Access Permission=-rwxrwx---,Last Modified=13Mar2016:09:26:31,File Size (bytes)=854NOTE: 18 records were read from the infile '/folders/myfolders/monkey.data.txt'.The minimum record length was 42.The maximum record length was 42.NOTE: The data set WORK.MEMORY has 90 observations and 5 variables.NOTE: DATA statement used (Total process time):real time 0.01 secondscpu time 0.02 seconds73 proc print;74NOTE: There were 90 observations read from the data set WORK.MEMORY.NOTE: PROCEDURE PRINT used (Total process time):real time 0.15 secondscpu time 0.15 seconds75 proc freq;76 tables time*treatment /norow nocol nopercent;77 tables monkey;78NOTE: There were 90 observations read from the data set WORK.MEMORY.NOTE: PROCEDURE FREQ used (Total process time):real time 0.07 secondscpu time 0.07 seconds79 proc mixed cl;80 title3 'Unstructured Covariance Matrix';81 class treatment time;82 model score = treatment|time;83 repeated / type=un subject=id r;84 /* Could have used subject=monkey, but then monkey must be declared in85 class because it's character-valued. */8687 /* We did not reject the null hypothesis that observations from the88 same subject are independent. Try an ordinary 2-way ANOVA, mostly89 for the interaction plot. */90NOTE: Convergence criteria met.NOTE: PROCEDURE MIXED used (Total process time):real time 0.12 secondscpu time 0.11 seconds91 proc glm;92 title3 'Ordinary 2-way';93 class time treatment; /* This order determines the plot. */94 model score = treatment|time;9596 /* Could justify compound symmetry: Each monkey brings her own special talent97 for discrimination learning. */98NOTE: PROCEDURE GLM used (Total process time):real time 0.70 secondscpu time 0.21 seconds99 proc mixed cl;100 title3 'Compound Symmetry';101 class treatment time;102 model score = treatment|time;103 repeated / type=cs subject=id r;104105 /* Contrast statements to follow up the interaction are possible106 but challenging. */107108NOTE: Convergence criteria met.NOTE: PROCEDURE MIXED used (Total process time):real time 0.10 secondscpu time 0.08 seconds109 proc glm;110 title3 'Classical (Same results as CS)';111 class treatment time monkey;112 model score = treatment|time monkey(treatment);113 random monkey(treatment) / test;114115 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;127