/*************************淡江某老師上課講義*************************/
title'example3.1 for singal-factor fixed model ';
data tensile;              /*照著講義打,但是log視窗會出現錯誤,不知如何修正*/
    do weight=15 to 35 by 5;
	input y@@;
	output;
	cards;
	7 7 15 11 9 12 17 12 18 18 14 18 18 19 19 19 25 22 19 23 7 10 11 15 11
	;
	run;
	proc print data=tensile;
	run;
proc glm;
class weight;
model y=weight;
means weight /scheffe tukey lsd duncan snk bon;
contrast 'mu4 vs. mu5' weight 0 0 0 -1 1;
contrast  'mu1+mu3 vs. mu4+mu5 ' weight 1 0 1 -1 -1;
contrast 'mu1 vs. mu3' weight 1 0 -1 0 0;
contrast '4mu2 vs. mu1+mu3+mu4+mu5' weight -1 4 -1 -1 -1;
run;
/*********************************************************************/

/***********************參考其他書修改如下***********************/
title'example3.1_singal-factor fixed model ';
title'棉含量對伸張力大小的實驗';
data tensile;
input weight y@@;
cards;
15 7 15 7 15 15 15 11 15 9
20 12 20 17 20 12 20 18 20 18
25 14 25 18 25 18 25 19 25 19
30 19 30 25 30 22 30 19 30 23
35 7 35 10 35 11 35 15 35 11
;
run;
proc glm;
class weight;
model y=weight;
means weight /scheffe tukey lsd duncan snk bon;
contrast 'mu4 vs. mu5' weight 0 0 0 -1 1;
contrast  'mu1+mu3 vs. mu4+mu5 ' weight 1 0 1 -1 -1;
contrast 'mu1 vs. mu3' weight 1 0 -1 0 0;
contrast '4mu2 vs. mu1+mu3+mu4+mu5' weight -1 4 -1 -1 -1;
run;

PROC ANOVA DATA=tensile;
     CLASS weight;
     MODEL y=weight;
     MEANS weight / LSD TUKEY CLDIFF;
RUN; QUIT;

/****************************************************************/