data result;
set group_t;
array g(3)returnA returnB returnC;
do group1=1 to 3;
v=g(group1);
output;
end;
drop return:;
run;
proc anova data=result;
class group group1;
model v=group group1;
means group1/ dunnett('1');
run; [/code]作者: shiyiming 时间: 2011-2-23 03:21 标题: Re: 再問平均數t檢定的問題? 不好意思,我想再请教大家,若我现在想将其每组报酬两两做比较(也就是说returnA中第一组和第二组比较,第二组和第三组比较,第三组和第四组比较,第四组和第五组比较,其它returnB和returnC也是以此方式做比较),看其平均值是否具有差异性,不知这样有办法做吗?group returnA returnB returnC
1 12 13 22
1 15 15 21
1 10 30 24
1 22 23 19
1 21 16 24
2 30 22 13
2 22 19 31
2 15 18 24
2 23 21 18
2 15 17 16
3 10 18 34
3 9 24 24
3 13 24 17
3 15 13 13
4 20 19 35
4 22 29 17
4 23 25 29
4 25 17 27
4 20 33 19
4 26 17 24
5 30 13 17
5 23 23 13
5 25 21 18
5 21 13 21作者: shiyiming 时间: 2011-2-23 07:10 标题: Re: 再問平均數t檢定的問題? [code:10odf21r]%macro multiTtests;
%do i =1 %to 4;
ods output ttests(persist =proc ) =ttests;
proc ttest data=had; where group in (&i, %eval(&i+1));
class group;
var returnA returnB returnC;
%end; run; ods output clear;
data ttests; keep groups variable tValue Probt;
length groups $10; set ttests;
if mod(_n_, 2); groups =catx(' vs. ', ceil(_n_/6), ceil(_n_/6) +1);
run;
%mend multiTtests;
%multiTtests;
proc print blankline =3; run;[/code:10odf21r]作者: shiyiming 时间: 2011-2-23 20:05 标题: Re: 再問平均數t檢定的問題? 不好意思,macro的使用方式其实我不太熟,且刚才试了一下,还是不能用,可否请前辈将用法完整的写出来,让我参考一下,谢谢了!!作者: shiyiming 时间: 2011-3-2 03:02 标题: Re: 再問平均數t檢定的問題? Under such a situation you can fit a GLM, while you put the group as a categorical variable in the "class" statement, and in the "model" statement you just put "group" as the only variable. Then the output wll give you 4 p-values that corresponds to the 4 groups comparing to the reference group (group 1).
Hope this is what you want~