1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;7273 /* pain2.sas */74 title 'Covariance structure repeated measures analysis of the pain data';7576 /* Read data from an old .xls spreadsheet */77 proc import datafile="/home/u1407221/441s24/data/Pain.xls"78 out=ouch0 dbms=xls replace;79 getnames=yes;NOTE: The import data set has 10 observations and 7 variables.NOTE: WORK.OUCH0 data set was successfully created.NOTE: PROCEDURE IMPORT used (Total process time):real time 0.00 secondsuser cpu time 0.01 secondssystem cpu time 0.00 secondsmemory 1547.59kOS Memory 29084.00kTimestamp 04/01/2024 11:54:28 PMStep Count 150 Switch Count 4Page Faults 0Page Reclaims 362Page Swaps 0Voluntary Context Switches 30Involuntary Context Switches 0Block Input Operations 0Block Output Operations 26480 proc print;8182 /* Dose 1 Dose 2 Dose 383 ------ ----- ------84 Drug 1 Drug1Dose1 Drug1Dose2 Drug1Dose385 Drug 2 Drug2Dose1 Drug2Dose2 Drug2Dose3 */86NOTE: There were 10 observations read from the data set WORK.OUCH0.NOTE: PROCEDURE PRINT used (Total process time):real time 0.03 secondsuser cpu time 0.03 secondssystem cpu time 0.00 secondsmemory 2584.40kOS Memory 28584.00kTimestamp 04/01/2024 11:54:28 PMStep Count 151 Switch Count 0Page Faults 0Page Reclaims 173Page Swaps 0Voluntary Context Switches 0Involuntary Context Switches 0Block Input Operations 0Block Output Operations 887 data hurt;88 set ouch0;89 /* Need each response on a separate line for proc mixed. */90 array response{6} Drug1Dose1 -- Drug2Dose3;91 index = 0;92 do drug = 1 to 2;93 do dose = 1 to 3;94 index = index + 1;95 pain = response{index};96 output;97 end;98 end;99 keep patient drug dose pain;100NOTE: There were 10 observations read from the data set WORK.OUCH0.NOTE: The data set WORK.HURT has 60 observations and 4 variables.NOTE: DATA statement used (Total process time):real time 0.00 secondsuser cpu time 0.01 secondssystem cpu time 0.00 secondsmemory 966.18kOS Memory 29100.00kTimestamp 04/01/2024 11:54:28 PMStep Count 152 Switch Count 2Page Faults 0Page Reclaims 150Page Swaps 0Voluntary Context Switches 14Involuntary Context Switches 0Block Input Operations 0Block Output Operations 264101 proc print data = hurt (obs=12); /* Just the first 12 lines */102NOTE: There were 12 observations read from the data set WORK.HURT.NOTE: PROCEDURE PRINT used (Total process time):real time 0.01 secondsuser cpu time 0.02 secondssystem cpu time 0.01 secondsmemory 707.18kOS Memory 28840.00kTimestamp 04/01/2024 11:54:28 PMStep Count 153 Switch Count 0Page Faults 0Page Reclaims 81Page Swaps 0Voluntary Context Switches 0Involuntary Context Switches 0Block Input Operations 0Block Output Operations 8103 proc mixed data=hurt;104 title2 'Unknown covariance structure';105 class drug dose;106 model pain = drug|dose;107 repeated / type=un subject=patient;108 /* Pairwise comparisons of marginal means for Dose */109 lsmeans dose / pdiff tdiff adjust = bon;110 run;NOTE: Convergence criteria met.NOTE: PROCEDURE MIXED used (Total process time):real time 0.10 secondsuser cpu time 0.10 secondssystem cpu time 0.00 secondsmemory 2012.75kOS Memory 30124.00kTimestamp 04/01/2024 11:54:28 PMStep Count 154 Switch Count 3Page Faults 0Page Reclaims 383Page Swaps 0Voluntary Context Switches 27Involuntary Context Switches 0Block Input Operations 0Block Output Operations 312111112 proc mixed data=hurt;113 title2 'Compound symmetry';114 class drug dose;115 model pain = drug|dose;116 repeated / type=cs subject=patient;117 lsmeans dose / pdiff tdiff adjust = bon;118 run;NOTE: Convergence criteria met.NOTE: PROCEDURE MIXED used (Total process time):real time 0.08 secondsuser cpu time 0.08 secondssystem cpu time 0.01 secondsmemory 1353.62kOS Memory 30124.00kTimestamp 04/01/2024 11:54:28 PMStep Count 155 Switch Count 3Page Faults 0Page Reclaims 192Page Swaps 0Voluntary Context Switches 25Involuntary Context Switches 2Block Input Operations 0Block Output Operations 304119120 /* F-tests from cs do not match up with the proc glm univariate tests121 in pain1.sas that are produced as a by-product of the multivariate122 approach. If you know how to read it, output from the code below123 shows that for this (simple and quite common) example, exact classical124 F-tests for the main effects do not exist unless the interaction is125 assumed to be absent. The proc mixed tests match what you get by making126 this assumption. It seems that the "by-product" univariate repeated127 measures analysis produced by proc glm is doing something else. I do128 not know exactly what it is doing, except that in every example I can129 find where all the classical tests DO exist, proc glm matches them.130 If we want the compound symmetry assumption, we will use proc mixed. */131132 proc glm data=hurt noprint; /* Not showing the output */133 title2 'Trying classical the old fashioned way';134 class patient drug dose;135 model pain = patient drug|dose;136 random patient / test;137 run;138 quit;NOTE: PROCEDURE GLM used (Total process time):real time 0.00 secondsuser cpu time 0.00 secondssystem cpu time 0.00 secondsmemory 1576.78kOS Memory 30904.00kTimestamp 04/01/2024 11:54:28 PMStep Count 156 Switch Count 3Page Faults 0Page Reclaims 221Page Swaps 0Voluntary Context Switches 25Involuntary Context Switches 0Block Input Operations 0Block Output Operations 288139140141142 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;154