1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;7273 /* grapefruit2.sas (2018 version) */74 title "Oneway ANOVA with repeated measures: Covariance Structure Approach";75 title2 'Grapefruit data (Applied linear statistical models, 5th ed., Prob 27.6)';7677 data grape1;78 infile '/folders/myfolders/441s18/Lecture/grapefruit1.data.txt' firstobs=2;79 input store sales1-sales3;NOTE: The infile '/folders/myfolders/441s18/Lecture/grapefruit1.data.txt' is:Filename=/folders/myfolders/441s18/Lecture/grapefruit1.data.txt,Owner Name=root,Group Name=vboxsf,Access Permission=-rwxrwx---,Last Modified=March 08, 2018 11:06:28,File Size (bytes)=522NOTE: 8 records were read from the infile '/folders/myfolders/441s18/Lecture/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.01 secondscpu time 0.01 seconds80 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.09 secondscpu time 0.09 seconds8283 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; */89NOTE: 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 secondscpu time 0.00 seconds90 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.09 secondscpu time 0.10 seconds9394 /* It's better to use arrays */9596 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;103NOTE: 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 secondscpu time 0.00 seconds104 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.06 secondscpu time 0.06 seconds106107 proc mixed data=grape3;108 title3 'Proc mixed with unknown covariance structure and lsmeans';109 title4 'Compare F = 29.66, p = 0.0008';110 class price;111 model sales = price;112 repeated / type=un subject=store r;113 lsmeans price / pdiff tdiff adjust = bon;114 /* Gives exactly pairwise matched t-tests in this case. */115NOTE: Convergence criteria met.NOTE: PROCEDURE MIXED used (Total process time):real time 0.25 secondscpu time 0.23 seconds116 proc mixed data=grape3;117 title3 'Proc mixed with compound symmetry cov. structure and contrasts';118 title4 'Compare F = 49.35, p < 0.0001';119 class price;120 model sales = price;121 contrast '1vs2' price 1 -1 0;122 contrast '1vs3' price 1 0 -1;123 contrast '2vs3' price 0 1 -1;124 repeated / type=cs subject=store r;125126127128 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;141