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