1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 /* grapefruit2.sas */
74 title "Oneway ANOVA with repeated measures: Covariance Structure Approach";
75 title2 'Grapefruit data (Applied linear statistical models, 5th ed., Prob 27.6)';
76
77 data grape1;
78 infile '/home/u1407221/441s24/data/grapefruit1.data.txt' firstobs=2;
79 input store sales1-sales3;
NOTE: The infile '/home/u1407221/441s24/data/grapefruit1.data.txt' is:
Filename=/home/u1407221/441s24/data/grapefruit1.data.txt,
Owner Name=u1407221,Group Name=oda,
Access Permission=-rw-r--r--,
Last Modified=24Mar2024:18:49:46,
File Size (bytes)=522
NOTE: 8 records were read from the infile '/home/u1407221/441s24/data/grapefruit1.data.txt'.
The minimum record length was 56.
The maximum record length was 56.
NOTE: The data set WORK.GRAPE1 has 8 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 772.56k
OS Memory 28328.00k
Timestamp 04/01/2024 11:52:35 PM
Step Count 136 Switch Count 2
Page Faults 0
Page Reclaims 147
Page Swaps 0
Voluntary Context Switches 18
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
80 proc print data=grape1;
81 run;
NOTE: There were 8 observations read from the data set WORK.GRAPE1.
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 2437.84k
OS Memory 28840.00k
Timestamp 04/01/2024 11:52:35 PM
Step Count 137 Switch Count 0
Page Faults 0
Page Reclaims 162
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 8
82
83 data grape2; /* This data set will have 3n cases. */
84 set grape1;
85 price = 1; sales = sales1; output; /* Output creates a new case. */
86 price = 2; sales = sales2; output;
87 price = 3; sales = sales3; output;
88 /* Would keep store price sales; */
89
NOTE: There were 8 observations read from the data set WORK.GRAPE1.
NOTE: The data set WORK.GRAPE2 has 24 observations and 6 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 960.37k
OS Memory 29356.00k
Timestamp 04/01/2024 11:52:35 PM
Step Count 138 Switch Count 2
Page Faults 0
Page Reclaims 175
Page Swaps 0
Voluntary Context Switches 12
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
90 proc print data=grape2;
91 title3 'Data set with one case per observation';
92 run;
NOTE: There were 24 observations read from the data set WORK.GRAPE2.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.03 seconds
user cpu time 0.03 seconds
system cpu time 0.00 seconds
memory 1080.12k
OS Memory 29096.00k
Timestamp 04/01/2024 11:52:35 PM
Step Count 139 Switch Count 1
Page Faults 0
Page Reclaims 124
Page Swaps 0
Voluntary Context Switches 10
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 16
93
94 /* It's better to use arrays */
95
96 data grape3;
97 set grape1;
98 array s{3} sales1-sales3;
99 do j = 1 to 3;
100 price = j; sales = s{j}; output;
101 end;
102 drop j sales1-sales3;
103
NOTE: There were 8 observations read from the data set WORK.GRAPE1.
NOTE: The data set WORK.GRAPE3 has 24 observations and 3 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 942.03k
OS Memory 29356.00k
Timestamp 04/01/2024 11:52:35 PM
Step Count 140 Switch Count 2
Page Faults 0
Page Reclaims 129
Page Swaps 0
Voluntary Context Switches 12
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
104 proc print data=grape3;
105 run;
NOTE: There were 24 observations read from the data set WORK.GRAPE3.
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 742.37k
OS Memory 29352.00k
Timestamp 04/01/2024 11:52:35 PM
Step Count 141 Switch Count 0
Page Faults 0
Page Reclaims 71
Page Swaps 0
Voluntary Context Switches 1
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 8
106
107 proc glm data = grape3 plots=none;
108 title3 'Brain dead between cases analysis';
109 class price;
110 model sales=price;
111 lsmeans price / pdiff tdiff adjust = bon;
112
NOTE: PROCEDURE GLM used (Total process time):
real time 0.07 seconds
user cpu time 0.07 seconds
system cpu time 0.00 seconds
memory 2614.21k
OS Memory 30904.00k
Timestamp 04/01/2024 11:52:35 PM
Step Count 142 Switch Count 3
Page Faults 0
Page Reclaims 448
Page Swaps 0
Voluntary Context Switches 24
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 312
113 proc mixed data=grape3;
114 title3 'Proc mixed with unknown covariance structure and lsmeans';
115 title4 'Compare F = 29.66, p = 0.0008';
116 class price;
117 model sales = price;
118 repeated / type=un subject=store r;
119 lsmeans price / pdiff tdiff adjust = bon;
120 /* Gives exactly pairwise matched t-tests in this case. */
121
NOTE: Convergence criteria met.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.08 seconds
user cpu time 0.08 seconds
system cpu time 0.01 seconds
memory 1425.18k
OS Memory 30380.00k
Timestamp 04/01/2024 11:52:35 PM
Step Count 143 Switch Count 4
Page Faults 0
Page Reclaims 250
Page Swaps 0
Voluntary Context Switches 31
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 312
122 proc mixed data=grape3;
123 title3 'Proc mixed with compound symmetry cov. structure and contrasts';
124 title4 'Compare F = 49.35, p < 0.0001';
125 class price;
126 model sales = price;
127 contrast '1vs2' price 1 -1 0;
128 contrast '1vs3' price 1 0 -1;
129 contrast '2vs3' price 0 1 -1;
130 repeated / type=cs subject=store r;
131
132 run;
NOTE: Convergence criteria met.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.07 seconds
user cpu time 0.07 seconds
system cpu time 0.00 seconds
memory 1201.15k
OS Memory 30636.00k
Timestamp 04/01/2024 11:52:36 PM
Step Count 144 Switch Count 4
Page Faults 0
Page Reclaims 136
Page Swaps 0
Voluntary Context Switches 32
Involuntary Context Switches 1
Block Input Operations 0
Block Output Operations 296
133 quit;
134
135
136
137 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
149