1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;NOTE: ODS statements in the SAS Studio environment may disable some output features.7374 /* pain1.sas */75 title 'Multivariate repeated measures analysis of the pain data';7677 /* 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 secondsuser cpu time 0.00 secondssystem cpu time 0.00 secondsmemory 1636.03kOS Memory 26268.00kTimestamp 03/25/2024 05:37:16 PMStep Count 24 Switch Count 2Page Faults 0Page Reclaims 496Page Swaps 0Voluntary Context Switches 18Involuntary Context Switches 0Block Input Operations 0Block Output Operations 26481 proc print;8283 /* Dose 1 Dose 2 Dose 384 ------ ----- ------85 Drug 1 Drug1Dose1 Drug1Dose2 Drug1Dose386 Drug 2 Drug2Dose1 Drug2Dose2 Drug2Dose3 */8788 /* 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 2644.25kOS Memory 27816.00kTimestamp 03/25/2024 05:37:16 PMStep Count 25 Switch Count 0Page Faults 0Page Reclaims 866Page Swaps 0Voluntary Context Switches 0Involuntary Context Switches 0Block Input Operations 0Block Output Operations 889 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;119NOTE: 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 1019.46kOS Memory 28332.00kTimestamp 03/25/2024 05:37:16 PMStep Count 26 Switch Count 2Page Faults 0Page Reclaims 186Page Swaps 0Voluntary Context Switches 15Involuntary Context Switches 0Block Input Operations 0Block Output Operations 272120 proc means data=ouch1 n mean stddev maxdec=3;121 var Drug1Dose1 -- Drug2Dose3122 Drug1 Drug2123 Dose1-Dose3124 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 secondsuser cpu time 0.04 secondssystem cpu time 0.00 secondsmemory 6851.43kOS Memory 33980.00kTimestamp 03/25/2024 05:37:16 PMStep Count 27 Switch Count 1Page Faults 0Page Reclaims 1822Page Swaps 0Voluntary Context Switches 22Involuntary Context Switches 0Block Input Operations 0Block Output Operations 0126127 /* Test for overall differences, main effects and interaction.128 Just look at the multivariate output. */129 ods select MultStat (persist);130131 proc reg data=ouch1;132 title2 'Overall test';133 model d12-d16 = ;134 Overall: mtest intercept = 0;135 run;136NOTE: PROCEDURE REG used (Total process time):real time 0.03 secondsuser cpu time 0.02 secondssystem cpu time 0.01 secondsmemory 2961.12kOS Memory 31168.00kTimestamp 03/25/2024 05:37:16 PMStep Count 28 Switch Count 2Page Faults 2Page Reclaims 1040Page Swaps 0Voluntary Context Switches 21Involuntary Context Switches 0Block Input Operations 344Block Output Operations 512137 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;143NOTE: PROCEDURE REG used (Total process time):real time 0.02 secondsuser cpu time 0.02 secondssystem cpu time 0.00 secondsmemory 2676.03kOS Memory 31424.00kTimestamp 03/25/2024 05:37:16 PMStep Count 29 Switch Count 2Page Faults 0Page Reclaims 314Page Swaps 0Voluntary Context Switches 20Involuntary Context Switches 0Block Input Operations 0Block Output Operations 320144 proc reg;145 title2 'Main Effect of Dose Level';146 model dosed12 dosed13 = ;147 Dose: mtest intercept = 0;148 run;149NOTE: PROCEDURE REG used (Total process time):real time 0.02 secondsuser cpu time 0.03 secondssystem cpu time 0.00 secondsmemory 2655.50kOS Memory 31424.00kTimestamp 03/25/2024 05:37:16 PMStep Count 30 Switch Count 2Page Faults 0Page Reclaims 265Page Swaps 0Voluntary Context Switches 18Involuntary Context Switches 0Block Input Operations 0Block Output Operations 304150 proc reg data=ouch1;151 title2 'Drug by Dose Interaction';152 model int1 int2 = ;153 Drug_by_Dose: mtest intercept = 0;154 run;155156 /* Follow up, including tests of pairwise difference157 even though the overall test was not significant. */158159 ods select all; /* Turning off the selection */160NOTE: PROCEDURE REG used (Total process time):real time 0.02 secondsuser cpu time 0.02 secondssystem cpu time 0.01 secondsmemory 2647.37kOS Memory 31424.00kTimestamp 03/25/2024 05:37:16 PMStep Count 31 Switch Count 3Page Faults 0Page Reclaims 267Page Swaps 0Voluntary Context Switches 26Involuntary Context Switches 0Block Input Operations 0Block Output Operations 328161 proc means data=ouch1 n mean t probt;162 title2 'Follow up with matched t-tests';163 var d12 -- d56164 dosed12--dosed23165 int1-int3 ;166167 /* Specify transformations of response variables within proc reg168169 Dose 1 Dose 2 Dose 3170 ------ ----- ------171 Drug 1 Drug1Dose1 Drug1Dose2 Drug1Dose3172 Drug 2 Drug2Dose1 Drug2Dose2 Drug2Dose3 */173174175 /* Strangely, after the first time I use ods select in a job, it only176 seems to work when I precede it with quit. ods is a little flaky177 with SAS OnDemand; maybe that's the reason. */178179 quit;NOTE: There were 10 observations read from the data set WORK.OUCH1.NOTE: PROCEDURE MEANS used (Total process time):real time 0.04 secondsuser cpu time 0.04 secondssystem cpu time 0.00 secondsmemory 7128.25kOS Memory 35508.00kTimestamp 03/25/2024 05:37:16 PMStep Count 32 Switch Count 2Page Faults 0Page Reclaims 1452Page Swaps 0Voluntary Context Switches 24Involuntary Context Switches 0Block Input Operations 0Block Output Operations 8179 ! 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+Drug1Dose3189 - 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;197198 quit;NOTE: PROCEDURE REG used (Total process time):real time 0.06 secondsuser cpu time 0.06 secondssystem cpu time 0.00 secondsmemory 2605.68kOS Memory 31936.00kTimestamp 03/25/2024 05:37:16 PMStep Count 33 Switch Count 2Page Faults 0Page Reclaims 267Page Swaps 0Voluntary Context Switches 17Involuntary Context Switches 0Block Input Operations 0Block Output Operations 80198 ! 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;205206 quit;NOTE: PROCEDURE GLM used (Total process time):real time 0.06 secondsuser cpu time 0.06 secondssystem cpu time 0.01 secondsmemory 2166.65kOS Memory 31416.00kTimestamp 03/25/2024 05:37:16 PMStep Count 34 Switch Count 3Page Faults 1Page Reclaims 403Page Swaps 0Voluntary Context Switches 27Involuntary Context Switches 0Block Input Operations 104Block Output Operations 328206 ! 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;211212 run;213 quit;NOTE: PROCEDURE GLM used (Total process time):real time 0.03 secondsuser cpu time 0.03 secondssystem cpu time 0.00 secondsmemory 2043.28kOS Memory 31416.00kTimestamp 03/25/2024 05:37:16 PMStep Count 35 Switch Count 3Page Faults 0Page Reclaims 229Page Swaps 0Voluntary Context Switches 30Involuntary Context Switches 0Block Input Operations 0Block Output Operations 312214215216217 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;229