1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
70
71 /* pain2.sas (2020 version) */
72 title 'Covariance structure repeated measures analysis of the pain data';
73
74 /* Read data from an old .xls spreadsheet */
75 proc import datafile="/home/brunner0/441s20/Pain.xls"
76 out=ouch0 dbms=xls replace;
77 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.01 seconds
memory 1465.12k
OS Memory 32152.00k
Timestamp 03/04/2020 03:51:12 PM
Step Count 56 Switch Count 2
Page Faults 0
Page Reclaims 446
Page Swaps 0
Voluntary Context Switches 17
Involuntary Context Switches 0
Block Input Operations 56
Block Output Operations 264
78 proc print;
79
80 /* Dose 1 Dose 2 Dose 3
81 ------ ----- ------
82 Drug 1 Drug1Dose1 Drug1Dose2 Drug1Dose3
83 Drug 2 Drug2Dose1 Drug2Dose2 Drug2Dose3 */
84
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.04 seconds
system cpu time 0.00 seconds
memory 2190.71k
OS Memory 31912.00k
Timestamp 03/04/2020 03:51:12 PM
Step Count 57 Switch Count 0
Page Faults 0
Page Reclaims 107
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 1
Block Input Operations 0
Block Output Operations 8
85 data hurt;
86 set ouch0;
87 /* Need each response on a separate line for proc mixed. */
88 array response{6} Drug1Dose1 -- Drug2Dose3;
89 index = 0;
90 do drug = 1 to 2;
91 do dose = 1 to 3;
92 index = index + 1;
93 pain = response{index};
94 output;
95 end;
96 end;
97 keep patient drug dose pain;
98
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.00 seconds
system cpu time 0.00 seconds
memory 947.56k
OS Memory 32428.00k
Timestamp 03/04/2020 03:51:12 PM
Step Count 58 Switch Count 2
Page Faults 0
Page Reclaims 149
Page Swaps 0
Voluntary Context Switches 15
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
99 proc print data = hurt (obs=12); /* Just the first 12 lines */
100
NOTE: There were 12 observations read from the data set WORK.HURT.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.02 seconds
user cpu time 0.02 seconds
system cpu time 0.00 seconds
memory 735.25k
OS Memory 32168.00k
Timestamp 03/04/2020 03:51:12 PM
Step Count 59 Switch Count 0
Page Faults 0
Page Reclaims 61
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
101 proc mixed data=hurt;
102 title2 'Unknown covariance structure';
103 class drug dose;
104 model pain = drug|dose;
105 repeated / type=un subject=patient;
106 /* Pairwise comparisons of marginal means for Dose */
107 lsmeans dose / pdiff tdiff adjust = bon;
108 run;
NOTE: Convergence criteria met.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.12 seconds
user cpu time 0.12 seconds
system cpu time 0.00 seconds
memory 1834.53k
OS Memory 32940.00k
Timestamp 03/04/2020 03:51:12 PM
Step Count 60 Switch Count 3
Page Faults 0
Page Reclaims 308
Page Swaps 0
Voluntary Context Switches 22
Involuntary Context Switches 1
Block Input Operations 0
Block Output Operations 312
109
110 proc mixed data=hurt;
111 title2 'Compound symmetry';
112 class drug dose;
113 model pain = drug|dose;
114 repeated / type=cs subject=patient;
115 lsmeans dose / pdiff tdiff adjust = bon;
116 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 1272.65k
OS Memory 32940.00k
Timestamp 03/04/2020 03:51:12 PM
Step Count 61 Switch Count 3
Page Faults 0
Page Reclaims 207
Page Swaps 0
Voluntary Context Switches 24
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 304
117
118 /* F-tests from cs do not match up with the proc glm univariate tests
119 in pain1.sas that are produced as a by-product of the multivariate
120 approach. If you know how to read it, output from the code below
121 shows that for this (simple and quite common) example, exact classical
122 F-tests for the main effects do not exist unless the interaction is
123 assumed to be absent. The proc mixed tests match what you get by making
124 this assumption. It seems that the "by-product" univariate repeated
125 measures analysis produced by proc glm is doing something else. I do
126 not know exactly what it is doing, except that in every example I can
127 find where all the classical tests DO exist, proc glm matches them.
128 If we want the compound symmetry assumption, we will use proc mixed. */
129
130 proc glm data=hurt noprint; /* Not showing the output */
131 title2 'Trying classical the old fashioned way';
132 class patient drug dose;
133 model pain = patient drug|dose;
134 random patient / test;
135 run;
136
137
138
139 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
150