1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;7071 /* 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)';7475 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)=522NOTE: 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 secondsuser cpu time 0.00 secondssystem cpu time 0.00 secondsmemory 758.46kOS Memory 31912.00kTimestamp 03/04/2020 03:46:05 PMStep Count 42 Switch Count 2Page Faults 0Page Reclaims 161Page Swaps 0Voluntary Context Switches 17Involuntary Context Switches 0Block Input Operations 0Block Output Operations 26478 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 secondsuser cpu time 0.03 secondssystem cpu time 0.00 secondsmemory 2121.68kOS Memory 31912.00kTimestamp 03/04/2020 03:46:05 PMStep Count 43 Switch Count 0Page Faults 0Page Reclaims 150Page Swaps 0Voluntary Context Switches 0Involuntary Context Switches 0Block Input Operations 0Block Output Operations 08081 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; */87NOTE: 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 secondsuser cpu time 0.00 secondssystem cpu time 0.00 secondsmemory 948.75kOS Memory 32428.00kTimestamp 03/04/2020 03:46:05 PMStep Count 44 Switch Count 2Page Faults 0Page Reclaims 157Page Swaps 0Voluntary Context Switches 14Involuntary Context Switches 0Block Input Operations 0Block Output Operations 26488 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 secondsuser cpu time 0.04 secondssystem cpu time 0.00 secondsmemory 961.18kOS Memory 32168.00kTimestamp 03/04/2020 03:46:05 PMStep Count 45 Switch Count 1Page Faults 0Page Reclaims 66Page Swaps 0Voluntary Context Switches 6Involuntary Context Switches 3Block Input Operations 0Block Output Operations 169192 /* It's better to use arrays */9394 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;101NOTE: 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 secondsuser cpu time 0.01 secondssystem cpu time 0.00 secondsmemory 946.43kOS Memory 32428.00kTimestamp 03/04/2020 03:46:05 PMStep Count 46 Switch Count 2Page Faults 0Page Reclaims 143Page Swaps 0Voluntary Context Switches 12Involuntary Context Switches 0Block Input Operations 0Block Output Operations 264102 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 secondsuser cpu time 0.03 secondssystem cpu time 0.00 secondsmemory 663.06kOS Memory 32168.00kTimestamp 03/04/2020 03:46:05 PMStep Count 47 Switch Count 0Page Faults 0Page Reclaims 65Page Swaps 0Voluntary Context Switches 0Involuntary Context Switches 0Block Input Operations 0Block Output Operations 8104105 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;110NOTE: PROCEDURE GLM used (Total process time):real time 0.08 secondsuser cpu time 0.09 secondssystem cpu time 0.00 secondsmemory 2508.31kOS Memory 33464.00kTimestamp 03/04/2020 03:46:05 PMStep Count 48 Switch Count 3Page Faults 0Page Reclaims 361Page Swaps 0Voluntary Context Switches 21Involuntary Context Switches 0Block Input Operations 0Block Output Operations 312111 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. */119NOTE: Convergence criteria met.NOTE: PROCEDURE MIXED used (Total process time):real time 0.10 secondsuser cpu time 0.11 secondssystem cpu time 0.01 secondsmemory 1377.56kOS Memory 32940.00kTimestamp 03/04/2020 03:46:05 PMStep Count 49 Switch Count 4Page Faults 0Page Reclaims 503Page Swaps 0Voluntary Context Switches 34Involuntary Context Switches 0Block Input Operations 0Block Output Operations 312120 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;129130131132 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;143