1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;NOTE: ODS statements in the SAS Studio environment may disable some output features.7172 /* pain1.sas (2020 version) */73 title 'Multivariate repeated measures analysis of the pain data';7475 /* 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 secondsuser cpu time 0.00 secondssystem cpu time 0.00 secondsmemory 1438.78kOS Memory 30872.00kTimestamp 03/01/2020 10:30:30 PMStep Count 105 Switch Count 4Page Faults 0Page Reclaims 333Page Swaps 0Voluntary Context Switches 28Involuntary Context Switches 0Block Input Operations 0Block Output Operations 26479 proc print;8081 /* Dose 1 Dose 2 Dose 382 ------ ----- ------83 Drug 1 Drug1Dose1 Drug1Dose2 Drug1Dose384 Drug 2 Drug2Dose1 Drug2Dose2 Drug2Dose3 */8586 /* 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 secondsuser cpu time 0.03 secondssystem cpu time 0.01 secondsmemory 2194.87kOS Memory 30632.00kTimestamp 03/01/2020 10:30:30 PMStep Count 106 Switch Count 0Page Faults 0Page Reclaims 110Page Swaps 0Voluntary Context Switches 0Involuntary Context Switches 0Block Input Operations 0Block Output Operations 887 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;117NOTE: 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 secondsuser cpu time 0.00 secondssystem cpu time 0.00 secondsmemory 1039.31kOS Memory 31148.00kTimestamp 03/01/2020 10:30:30 PMStep Count 107 Switch Count 2Page Faults 0Page Reclaims 151Page Swaps 0Voluntary Context Switches 14Involuntary Context Switches 0Block Input Operations 0Block Output Operations 264118 proc means data=ouch1 n mean stddev maxdec=3;119 var Drug1Dose1 -- Drug2Dose3120 Drug1 Drug2121 Dose1-Dose3122 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 secondsuser cpu time 0.05 secondssystem cpu time 0.00 secondsmemory 6797.87kOS Memory 36540.00kTimestamp 03/01/2020 10:30:30 PMStep Count 108 Switch Count 1Page Faults 0Page Reclaims 1492Page Swaps 0Voluntary Context Switches 17Involuntary Context Switches 0Block Input Operations 0Block Output Operations 0124125 /* Test for overall differences, main effects and interaction.126 Just look at the multivariate output. */127 ods select MultStat (persist);128129 proc reg data=ouch1;130 title2 'Overall test';131 model d12-d16 = ;132 Overall: mtest intercept = 0;133 run;134NOTE: PROCEDURE REG used (Total process time):real time 0.03 secondsuser cpu time 0.03 secondssystem cpu time 0.01 secondsmemory 2790.06kOS Memory 32960.00kTimestamp 03/01/2020 10:30:30 PMStep Count 109 Switch Count 2Page Faults 0Page Reclaims 265Page Swaps 0Voluntary Context Switches 17Involuntary Context Switches 0Block Input Operations 0Block Output Operations 512135 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;141NOTE: PROCEDURE REG used (Total process time):real time 0.02 secondsuser cpu time 0.03 secondssystem cpu time 0.00 secondsmemory 2635.18kOS Memory 33216.00kTimestamp 03/01/2020 10:30:30 PMStep Count 110 Switch Count 2Page Faults 0Page Reclaims 295Page Swaps 0Voluntary Context Switches 19Involuntary Context Switches 0Block Input Operations 0Block Output Operations 312142 proc reg;143 title2 'Main Effect of Dose Level';144 model dosed12 dosed13 = ;145 Dose: mtest intercept = 0;146 run;147NOTE: PROCEDURE REG used (Total process time):real time 0.03 secondsuser cpu time 0.03 secondssystem cpu time 0.00 secondsmemory 2632.93kOS Memory 33216.00kTimestamp 03/01/2020 10:30:30 PMStep Count 111 Switch Count 2Page Faults 0Page Reclaims 262Page Swaps 0Voluntary Context Switches 20Involuntary Context Switches 0Block Input Operations 0Block Output Operations 304148 proc reg data=ouch1;149 title2 'Drug by Dose Interaction';150 model int1 int2 = ;151 Drug_by_Dose: mtest intercept = 0;152 run;153154 /* Follow up, including tests of pairwise difference155 even though the overall test was not significant. */156157 ods select all; /* Turning off the selection */158NOTE: PROCEDURE REG used (Total process time):real time 0.03 secondsuser cpu time 0.02 secondssystem cpu time 0.00 secondsmemory 2635.87kOS Memory 33216.00kTimestamp 03/01/2020 10:30:30 PMStep Count 112 Switch Count 3Page Faults 0Page Reclaims 258Page Swaps 0Voluntary Context Switches 26Involuntary Context Switches 0Block Input Operations 0Block Output Operations 328159 proc means data=ouch1 n mean t probt;160 title2 'Follow up with matched t-tests';161 var d12 -- d56162 dosed12--dosed23163 int1-int3 ;164165 /* Specify transformations of response variables within proc reg166167 Dose 1 Dose 2 Dose 3168 ------ ----- ------169 Drug 1 Drug1Dose1 Drug1Dose2 Drug1Dose3170 Drug 2 Drug2Dose1 Drug2Dose2 Drug2Dose3 */171172173 /* Strangely, after the first time I use ods select in a job, it only174 seems to work when I precede it with quit. ods is a little flaky175 with SAS On Demand; maybe that's the reason. */176177 quit;NOTE: There were 10 observations read from the data set WORK.OUCH1.NOTE: PROCEDURE MEANS used (Total process time):real time 0.06 secondsuser cpu time 0.06 secondssystem cpu time 0.01 secondsmemory 6684.59kOS Memory 36788.00kTimestamp 03/01/2020 10:30:30 PMStep Count 113 Switch Count 2Page Faults 0Page Reclaims 1354Page Swaps 0Voluntary Context Switches 30Involuntary Context Switches 0Block Input Operations 0Block Output Operations 0177 ! 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+Drug1Dose3187 - 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;195196 quit;NOTE: PROCEDURE REG used (Total process time):real time 0.07 secondsuser cpu time 0.08 secondssystem cpu time 0.00 secondsmemory 2521.40kOS Memory 33216.00kTimestamp 03/01/2020 10:30:30 PMStep Count 114 Switch Count 2Page Faults 0Page Reclaims 260Page Swaps 0Voluntary Context Switches 15Involuntary Context Switches 0Block Input Operations 0Block Output Operations 80196 ! 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;203204 quit;NOTE: PROCEDURE GLM used (Total process time):real time 0.08 secondsuser cpu time 0.08 secondssystem cpu time 0.00 secondsmemory 2051.81kOS Memory 32952.00kTimestamp 03/01/2020 10:30:30 PMStep Count 115 Switch Count 3Page Faults 0Page Reclaims 234Page Swaps 0Voluntary Context Switches 21Involuntary Context Switches 0Block Input Operations 0Block Output Operations 328204 ! 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;210211212213214215216217218 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;229