1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
70
71 /* grapefruit2.sas (2020 version) */
72 title "Oneway ANOVA with repeated measures: Covariance Structure Approach";
73 title2 'Grapefruit data (Applied linear statistical models, 5th ed., Prob 27.6)';
74
75 data grape1;
76 infile '/home/brunner0/441s20/grapefruit1.data.txt' firstobs=2;
77 input store sales1-sales3;
NOTE: The infile '/home/brunner0/441s20/grapefruit1.data.txt' is:
Filename=/home/brunner0/441s20/grapefruit1.data.txt,
Owner Name=brunner0,Group Name=oda,
Access Permission=-rw-r--r--,
Last Modified=01Mar2020:17:02:42,
File Size (bytes)=522
NOTE: 8 records were read from the infile '/home/brunner0/441s20/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 758.46k
OS Memory 31912.00k
Timestamp 03/04/2020 03:46:05 PM
Step Count 42 Switch Count 2
Page Faults 0
Page Reclaims 161
Page Swaps 0
Voluntary Context Switches 17
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
78 proc print data=grape1;
79 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.03 seconds
system cpu time 0.00 seconds
memory 2121.68k
OS Memory 31912.00k
Timestamp 03/04/2020 03:46:05 PM
Step Count 43 Switch Count 0
Page Faults 0
Page Reclaims 150
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
80
81 data grape2; /* This data set will have 3n cases. */
82 set grape1;
83 price = 1; sales = sales1; output; /* Output creates a new case. */
84 price = 2; sales = sales2; output;
85 price = 3; sales = sales3; output;
86 /* Would keep store price sales; */
87
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 948.75k
OS Memory 32428.00k
Timestamp 03/04/2020 03:46:05 PM
Step Count 44 Switch Count 2
Page Faults 0
Page Reclaims 157
Page Swaps 0
Voluntary Context Switches 14
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
88 proc print data=grape2;
89 title3 'Data set with one case per observation';
90 run;
NOTE: There were 24 observations read from the data set WORK.GRAPE2.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.04 seconds
user cpu time 0.04 seconds
system cpu time 0.00 seconds
memory 961.18k
OS Memory 32168.00k
Timestamp 03/04/2020 03:46:05 PM
Step Count 45 Switch Count 1
Page Faults 0
Page Reclaims 66
Page Swaps 0
Voluntary Context Switches 6
Involuntary Context Switches 3
Block Input Operations 0
Block Output Operations 16
91
92 /* It's better to use arrays */
93
94 data grape3;
95 set grape1;
96 array s{3} sales1-sales3;
97 do j = 1 to 3;
98 price = j; sales = s{j}; output;
99 end;
100 drop j sales1-sales3;
101
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.01 seconds
system cpu time 0.00 seconds
memory 946.43k
OS Memory 32428.00k
Timestamp 03/04/2020 03:46:05 PM
Step Count 46 Switch Count 2
Page Faults 0
Page Reclaims 143
Page Swaps 0
Voluntary Context Switches 12
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
102 proc print data=grape3;
103 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.03 seconds
system cpu time 0.00 seconds
memory 663.06k
OS Memory 32168.00k
Timestamp 03/04/2020 03:46:05 PM
Step Count 47 Switch Count 0
Page Faults 0
Page Reclaims 65
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 8
104
105 proc glm data = grape3 plots=none;
106 title3 'Brain dead between cases analysis';
107 class price;
108 model sales=price;
109 lsmeans price / pdiff tdiff adjust = bon;
110
NOTE: PROCEDURE GLM used (Total process time):
real time 0.08 seconds
user cpu time 0.09 seconds
system cpu time 0.00 seconds
memory 2508.31k
OS Memory 33464.00k
Timestamp 03/04/2020 03:46:05 PM
Step Count 48 Switch Count 3
Page Faults 0
Page Reclaims 361
Page Swaps 0
Voluntary Context Switches 21
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 312
111 proc mixed data=grape3;
112 title3 'Proc mixed with unknown covariance structure and lsmeans';
113 title4 'Compare F = 29.66, p = 0.0008';
114 class price;
115 model sales = price;
116 repeated / type=un subject=store r;
117 lsmeans price / pdiff tdiff adjust = bon;
118 /* Gives exactly pairwise matched t-tests in this case. */
119
NOTE: Convergence criteria met.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.10 seconds
user cpu time 0.11 seconds
system cpu time 0.01 seconds
memory 1377.56k
OS Memory 32940.00k
Timestamp 03/04/2020 03:46:05 PM
Step Count 49 Switch Count 4
Page Faults 0
Page Reclaims 503
Page Swaps 0
Voluntary Context Switches 34
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 312
120 proc mixed data=grape3;
121 title3 'Proc mixed with compound symmetry cov. structure and contrasts';
122 title4 'Compare F = 49.35, p < 0.0001';
123 class price;
124 model sales = price;
125 contrast '1vs2' price 1 -1 0;
126 contrast '1vs3' price 1 0 -1;
127 contrast '2vs3' price 0 1 -1;
128 repeated / type=cs subject=store r;
129
130
131
132 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
143