1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;NOTE: ODS statements in the SAS Studio environment may disable some output features.7374 /* monkey2.sas (2018 version) */75 title 'Covariance structure approach on the monkey data';76 title2 'Primate hippocampal function: Zola-Morgan and Squire (1990)';77 /* Science, Vol. 250 (12 Oct. 1990) , Pages 288-290 */787980 data remember;81 infile '/folders/myfolders/441s18/Lecture/monkey.data.txt' firstobs=2;82 input monkey $ treatment $ week2 week4 week8 week12 week16;83 /* Need one line per response */84 id = _n_; /* A little more convenient than the monkeys' names */85 t2=2; t4=4; t8=8; t12=12; t16=16; /* Time since learning the task in weeks */86 array t{5} t2 -- t16;87 array week{5} week2 -- week16;88 do j = 1 to 5;89 time = t{j};90 score = week{j};91 output;92 end;93 keep monkey treatment id time score;94NOTE: The infile '/folders/myfolders/441s18/Lecture/monkey.data.txt' is:Filename=/folders/myfolders/441s18/Lecture/monkey.data.txt,Owner Name=root,Group Name=vboxsf,Access Permission=-rwxrwx---,Last Modified=08Mar2018:12:50:29,File Size (bytes)=854NOTE: 18 records were read from the infile '/folders/myfolders/441s18/Lecture/monkey.data.txt'.The minimum record length was 42.The maximum record length was 42.NOTE: The data set WORK.REMEMBER has 90 observations and 5 variables.NOTE: DATA statement used (Total process time):real time 0.00 secondscpu time 0.00 seconds95 proc print data=remember (obs=10); /* Just first 10 lines */96 run;NOTE: There were 10 observations read from the data set WORK.REMEMBER.NOTE: PROCEDURE PRINT used (Total process time):real time 0.04 secondscpu time 0.05 seconds9798 proc mixed data=remember;99 title3 'Unstructured Covariance Matrix';100 class treatment time;101 model score = treatment|time;102 repeated / type=un subject=id r;103 /* Could have used subject=monkey, but then monkey must be declared in104 class because it's character-valued. */105 run;NOTE: Convergence criteria met.NOTE: PROCEDURE MIXED used (Total process time):real time 0.11 secondscpu time 0.10 seconds106107 /* Could justify compound symmetry: Each monkey brings her own special talent108 for discrimination learning. */109110 proc mixed data=remember;111 title3 'Compound Symmetry';112 class treatment time;113 model score = treatment|time;114 repeated / type=cs subject=id r;115 run;NOTE: Convergence criteria met.NOTE: PROCEDURE MIXED used (Total process time):real time 0.09 secondscpu time 0.09 seconds116117 /* You can test hypotheses with proc mixed that are out of reach with118 other software. */119120 data forget;121 set remember;122 if treatment = 'CONTROL' then treat=1; else treat=2;123 combo = 100*treat + time;124 /*125 proc freq;126 tables (treatment time) * combo / norow nocol nopercent missing;127 */NOTE: There were 90 observations read from the data set WORK.REMEMBER.NOTE: The data set WORK.FORGET has 90 observations and 7 variables.NOTE: DATA statement used (Total process time):real time 0.00 secondscpu time 0.01 seconds128 proc means mean maxdec=3;129 class combo;130 var score;131132 quit;NOTE: There were 90 observations read from the data set WORK.FORGET.NOTE: PROCEDURE MEANS used (Total process time):real time 0.03 secondscpu time 0.02 seconds133 ods select Contrasts Estimates;134 proc mixed data=forget;135 title3 'Test treatment effect at each week, and estimate one difference';136 class combo;137 model score = combo;138 repeated / type=cs subject=id r;139 /* Control Treated */140 /* 2 4 8 12 16 2 4 8 12 16 */141 /* ------------------------------- */142 contrast 'TreatAtWeek2' combo 1 0 0 0 0 -1 0 0 0 0;143 contrast 'TreatAtWeek4' combo 0 1 0 0 0 0 -1 0 0 0;144 contrast 'TreatAtWeek8' combo 0 0 1 0 0 0 0 -1 0 0;145 contrast 'TreatAtWeek12' combo 0 0 0 1 0 0 0 0 -1 0;146 contrast 'TreatAtWeek16' combo 0 0 0 0 1 0 0 0 0 -1;147 /* Estimate difference between Treated at Week 2 and Control at Week 16 */148 estimate 'Control16 minus Treated2'149 combo 0 0 0 0 1 -1 0 0 0 0 / CL;150 run;NOTE: Convergence criteria met.NOTE: PROCEDURE MIXED used (Total process time):real time 0.05 secondscpu time 0.04 seconds151152153154155 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;168