1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
71
72 /* pain1.sas (2020 version) */
73 title 'Multivariate repeated measures analysis of the pain data';
74
75 /* Read data from an old .xls spreadsheet */
76 proc import datafile="/home/brunner0/441s20/Pain.xls"
77 out=ouch0 dbms=xls replace;
78 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.00 seconds
system cpu time 0.00 seconds
memory 1438.78k
OS Memory 30872.00k
Timestamp 03/01/2020 10:30:30 PM
Step Count 105 Switch Count 4
Page Faults 0
Page Reclaims 333
Page Swaps 0
Voluntary Context Switches 28
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
79 proc print;
80
81 /* Dose 1 Dose 2 Dose 3
82 ------ ----- ------
83 Drug 1 Drug1Dose1 Drug1Dose2 Drug1Dose3
84 Drug 2 Drug2Dose1 Drug2Dose2 Drug2Dose3 */
85
86 /* Computing sum and contrast variables in the data step */
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.01 seconds
memory 2194.87k
OS Memory 30632.00k
Timestamp 03/01/2020 10:30:30 PM
Step Count 106 Switch Count 0
Page Faults 0
Page Reclaims 110
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 8
87 data ouch1;
88 set ouch0;
89 /* Pairwise differences */
90 d12 = Drug1Dose1-Drug1Dose2; d13 = Drug1Dose1-Drug1Dose3;
91 d14 = Drug1Dose1-Drug2Dose1; d15 = Drug1Dose1-Drug2Dose2;
92 d16 = Drug1Dose1-Drug2Dose3;
93 d23 = Drug1Dose2-Drug1Dose3; d24 = Drug1Dose2-Drug2Dose1;
94 d25 = Drug1Dose2-Drug2Dose2; d26 = Drug1Dose2-Drug2Dose3;
95 d34 = Drug1Dose3-Drug2Dose1; d35 = Drug1Dose3-Drug2Dose2;
96 d36 = Drug1Dose3-Drug2Dose3;
97 d45 = Drug2Dose1-Drug2Dose2; d46 = Drug2Dose1-Drug2Dose3;
98 d56 = Drug2Dose2-Drug2Dose3;
99 /* Marginal means and interactions */
100 Drug1 = mean(of Drug1Dose1--Drug1Dose3);
101 Drug2 = mean(of Drug2Dose1--Drug2Dose3);
102 Dose1 = (Drug1Dose1+Drug2Dose1)/2;
103 Dose2 = (Drug1Dose2+Drug2Dose2)/2;
104 Dose3 = (Drug1Dose3+Drug2Dose3)/2;
105 Drugdiff = drug1-drug2;
106 doseD12 = dose1-dose2; doseD13 = dose1-dose3;
107 doseD23 = dose2-dose3;
108 DrugEffect1 = Drug1Dose1-Drug2Dose1;
109 DrugEffect2 = Drug1Dose2-Drug2Dose2;
110 DrugEffect3 = Drug1Dose3-Drug2Dose3;
111 label DrugEffect1 = 'Drug effect for dose 1'
112 DrugEffect2 = 'Drug effect for dose 2'
113 DrugEffect3 = 'Drug effect for dose 3';
114 int1 = DrugEffect1-DrugEffect2;
115 int2 = DrugEffect1-DrugEffect3;
116 int3 = DrugEffect2-DrugEffect3;
117
NOTE: There were 10 observations read from the data set WORK.OUCH0.
NOTE: The data set WORK.OUCH1 has 10 observations and 37 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 1039.31k
OS Memory 31148.00k
Timestamp 03/01/2020 10:30:30 PM
Step Count 107 Switch Count 2
Page Faults 0
Page Reclaims 151
Page Swaps 0
Voluntary Context Switches 14
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
118 proc means data=ouch1 n mean stddev maxdec=3;
119 var Drug1Dose1 -- Drug2Dose3
120 Drug1 Drug2
121 Dose1-Dose3
122 DrugEffect1-DrugEffect3;
123 run;
NOTE: There were 10 observations read from the data set WORK.OUCH1.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.05 seconds
user cpu time 0.05 seconds
system cpu time 0.00 seconds
memory 6797.87k
OS Memory 36540.00k
Timestamp 03/01/2020 10:30:30 PM
Step Count 108 Switch Count 1
Page Faults 0
Page Reclaims 1492
Page Swaps 0
Voluntary Context Switches 17
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
124
125 /* Test for overall differences, main effects and interaction.
126 Just look at the multivariate output. */
127 ods select MultStat (persist);
128
129 proc reg data=ouch1;
130 title2 'Overall test';
131 model d12-d16 = ;
132 Overall: mtest intercept = 0;
133 run;
134
NOTE: PROCEDURE REG used (Total process time):
real time 0.03 seconds
user cpu time 0.03 seconds
system cpu time 0.01 seconds
memory 2790.06k
OS Memory 32960.00k
Timestamp 03/01/2020 10:30:30 PM
Step Count 109 Switch Count 2
Page Faults 0
Page Reclaims 265
Page Swaps 0
Voluntary Context Switches 17
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 512
135 proc reg data=ouch1;
136 title2 'Main Effect of Drug';
137 model drugdiff = ;
138 Drug: mtest intercept = 0;
139 /* Could have used test or just looked at the t statistic. */
140 run;
141
NOTE: PROCEDURE REG used (Total process time):
real time 0.02 seconds
user cpu time 0.03 seconds
system cpu time 0.00 seconds
memory 2635.18k
OS Memory 33216.00k
Timestamp 03/01/2020 10:30:30 PM
Step Count 110 Switch Count 2
Page Faults 0
Page Reclaims 295
Page Swaps 0
Voluntary Context Switches 19
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 312
142 proc reg;
143 title2 'Main Effect of Dose Level';
144 model dosed12 dosed13 = ;
145 Dose: mtest intercept = 0;
146 run;
147
NOTE: PROCEDURE REG used (Total process time):
real time 0.03 seconds
user cpu time 0.03 seconds
system cpu time 0.00 seconds
memory 2632.93k
OS Memory 33216.00k
Timestamp 03/01/2020 10:30:30 PM
Step Count 111 Switch Count 2
Page Faults 0
Page Reclaims 262
Page Swaps 0
Voluntary Context Switches 20
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 304
148 proc reg data=ouch1;
149 title2 'Drug by Dose Interaction';
150 model int1 int2 = ;
151 Drug_by_Dose: mtest intercept = 0;
152 run;
153
154 /* Follow up, including tests of pairwise difference
155 even though the overall test was not significant. */
156
157 ods select all; /* Turning off the selection */
158
NOTE: PROCEDURE REG used (Total process time):
real time 0.03 seconds
user cpu time 0.02 seconds
system cpu time 0.00 seconds
memory 2635.87k
OS Memory 33216.00k
Timestamp 03/01/2020 10:30:30 PM
Step Count 112 Switch Count 3
Page Faults 0
Page Reclaims 258
Page Swaps 0
Voluntary Context Switches 26
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 328
159 proc means data=ouch1 n mean t probt;
160 title2 'Follow up with matched t-tests';
161 var d12 -- d56
162 dosed12--dosed23
163 int1-int3 ;
164
165 /* Specify transformations of response variables within proc reg
166
167 Dose 1 Dose 2 Dose 3
168 ------ ----- ------
169 Drug 1 Drug1Dose1 Drug1Dose2 Drug1Dose3
170 Drug 2 Drug2Dose1 Drug2Dose2 Drug2Dose3 */
171
172
173 /* Strangely, after the first time I use ods select in a job, it only
174 seems to work when I precede it with quit. ods is a little flaky
175 with SAS On Demand; maybe that's the reason. */
176
177 quit;
NOTE: There were 10 observations read from the data set WORK.OUCH1.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.06 seconds
user cpu time 0.06 seconds
system cpu time 0.01 seconds
memory 6684.59k
OS Memory 36788.00k
Timestamp 03/01/2020 10:30:30 PM
Step Count 113 Switch Count 2
Page Faults 0
Page Reclaims 1354
Page Swaps 0
Voluntary Context Switches 30
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
177 ! ods select MultStat;
178 proc reg data=ouch0 plots=none;
179 title2 'Specify new response variables within proc reg';
180 model Drug1Dose1 -- Drug2Dose3 = ;
181 Overall: mtest intercept = 0,
182 Drug1Dose1-Drug1Dose2, Drug1Dose1-Drug1Dose3,
183 Drug1Dose1-Drug2Dose1, Drug1Dose1-Drug2Dose2,
184 Drug1Dose1-Drug2Dose3;
185 Drug: mtest intercept = 0,
186 Drug1Dose1+Drug1Dose2+Drug1Dose3
187 - Drug2Dose1-Drug2Dose2-Drug2Dose3;
188 Dose: mtest intercept = 0,
189 Drug1Dose1+Drug2Dose1 - Drug1Dose2-Drug2Dose2,
190 Drug1Dose2+Drug2Dose2 - Drug1Dose3-Drug2Dose3;
191 Interaction: mtest intercept = 0,
192 Drug1Dose1-Drug2Dose1 - Drug1Dose2+Drug2Dose2,
193 Drug1Dose1-Drug2Dose1 - Drug1Dose3+Drug2Dose3;
194 run;
195
196 quit;
NOTE: PROCEDURE REG used (Total process time):
real time 0.07 seconds
user cpu time 0.08 seconds
system cpu time 0.00 seconds
memory 2521.40k
OS Memory 33216.00k
Timestamp 03/01/2020 10:30:30 PM
Step Count 114 Switch Count 2
Page Faults 0
Page Reclaims 260
Page Swaps 0
Voluntary Context Switches 15
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 80
196 ! ods select MultStat GLM.Repeated.WithinSubject.ModelANOVA;
197 proc glm data=ouch0;
198 title2 'Two-factor within cases the easy way';
199 model Drug1Dose1--Drug2Dose3 = ;
200 repeated Drug 2, Dosage 3 / short summary;
201 /* Factor on the right changes fastest (like numbers) */
202 run;
203
204 quit;
NOTE: PROCEDURE GLM used (Total process time):
real time 0.08 seconds
user cpu time 0.08 seconds
system cpu time 0.00 seconds
memory 2051.81k
OS Memory 32952.00k
Timestamp 03/01/2020 10:30:30 PM
Step Count 115 Switch Count 3
Page Faults 0
Page Reclaims 234
Page Swaps 0
Voluntary Context Switches 21
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 328
204 ! ods select MultStat GLM.Repeated.WithinSubject.ModelANOVA;
205 proc glm data=ouch0;
206 title2 'Overall test the easy way';
207 model Drug1Dose1--Drug2Dose3 = ;
208 repeated treatment / short summary;
209 run;
210
211
212
213
214
215
216
217
218 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
229