1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 /* pain2.sas */
74 title 'Covariance structure repeated measures analysis of the pain data';
75
76 /* 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 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 1547.59k
OS Memory 29084.00k
Timestamp 04/01/2024 11:54:28 PM
Step Count 150 Switch Count 4
Page Faults 0
Page Reclaims 362
Page Swaps 0
Voluntary Context Switches 30
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
80 proc print;
81
82 /* Dose 1 Dose 2 Dose 3
83 ------ ----- ------
84 Drug 1 Drug1Dose1 Drug1Dose2 Drug1Dose3
85 Drug 2 Drug2Dose1 Drug2Dose2 Drug2Dose3 */
86
NOTE: There were 10 observations read from the data set WORK.OUCH0.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.03 seconds
user cpu time 0.03 seconds
system cpu time 0.00 seconds
memory 2584.40k
OS Memory 28584.00k
Timestamp 04/01/2024 11:54:28 PM
Step Count 151 Switch Count 0
Page Faults 0
Page Reclaims 173
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 8
87 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;
100
NOTE: 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 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 966.18k
OS Memory 29100.00k
Timestamp 04/01/2024 11:54:28 PM
Step Count 152 Switch Count 2
Page Faults 0
Page Reclaims 150
Page Swaps 0
Voluntary Context Switches 14
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
101 proc print data = hurt (obs=12); /* Just the first 12 lines */
102
NOTE: There were 12 observations read from the data set WORK.HURT.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
user cpu time 0.02 seconds
system cpu time 0.01 seconds
memory 707.18k
OS Memory 28840.00k
Timestamp 04/01/2024 11:54:28 PM
Step Count 153 Switch Count 0
Page Faults 0
Page Reclaims 81
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 8
103 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 seconds
user cpu time 0.10 seconds
system cpu time 0.00 seconds
memory 2012.75k
OS Memory 30124.00k
Timestamp 04/01/2024 11:54:28 PM
Step Count 154 Switch Count 3
Page Faults 0
Page Reclaims 383
Page Swaps 0
Voluntary Context Switches 27
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 312
111
112 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 seconds
user cpu time 0.08 seconds
system cpu time 0.01 seconds
memory 1353.62k
OS Memory 30124.00k
Timestamp 04/01/2024 11:54:28 PM
Step Count 155 Switch Count 3
Page Faults 0
Page Reclaims 192
Page Swaps 0
Voluntary Context Switches 25
Involuntary Context Switches 2
Block Input Operations 0
Block Output Operations 304
119
120 /* F-tests from cs do not match up with the proc glm univariate tests
121 in pain1.sas that are produced as a by-product of the multivariate
122 approach. If you know how to read it, output from the code below
123 shows that for this (simple and quite common) example, exact classical
124 F-tests for the main effects do not exist unless the interaction is
125 assumed to be absent. The proc mixed tests match what you get by making
126 this assumption. It seems that the "by-product" univariate repeated
127 measures analysis produced by proc glm is doing something else. I do
128 not know exactly what it is doing, except that in every example I can
129 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. */
131
132 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 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 1576.78k
OS Memory 30904.00k
Timestamp 04/01/2024 11:54:28 PM
Step Count 156 Switch Count 3
Page Faults 0
Page Reclaims 221
Page Swaps 0
Voluntary Context Switches 25
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 288
139
140
141
142 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
154