以下純屬為了方便計算2X2列聯所產生的簡易視窗版輸入,直接執行以下語法就能產生2X2列聯表
僅供方便將次數後的結果做2X2的卡方檢定,且視窗仍在改良中,趣味趣味玩玩就好。
Data Tablewindow;
retain x1 0 x2 0 x3 0 x4 0;
window Table Color=white Columns=100 Rows=100
#3 @58 '變相X' color=red
#4 @53 'X=1' color=blue
#4 @63 'X=2' color=blue
#7 @44 '變' color=red
#8 @44 '項' color=red
#9 @44 'Y' color=red
#7 @47 'Y=1' color=blue
#9 @47 'Y=2' color=blue
#5 @50 '---------------------'
#6 @50 '|' #6 @60 '|' #6 @70 '|'
#7 @50 '|' #7 @60 '|' #7 @70 '|'
#8 @50 '|---------' #8 @60 '|---------' #8 @70 '|'
#9 @50 '|' #9 @60 '|' #9 @70 '|'
#10 @50 '|' #10 @60 '|' #10 @70 '|'
#11 @50 '---------------------'
#6 @51 x1 5. color=red a=underline auto=yes required=yes
#6 @61 x2 5. color=red a=underline auto=yes required=yes
#9 @51 x3 5. color=red a=underline auto=yes required=yes
#9 @61 x4 5. color=red a=underline auto=yes required=yes
#14 @50 "各欄位數值鍵入完請按Enter以方便跳位"
#15 @50 "鍵入完成後請至上方Command===>處鍵入 : end"
;
Display Table;
run;
proc transpose data=Tablewindow prefix=weight name=local out=weightnum;
run;
data tablelocal;
input x y local$;
cards;
1 1 x1
2 1 x2
1 2 x3
2 2 x4
;
run;
data tablecom;
update tablelocal weightnum; by local;
run;
proc freq ;
label x="變項一" y="變項二";
table y*x /chisq norow nocol nopercent;
weight weight1;
run;
沒有留言:
張貼留言