Categorical Data Analysis: Chapter 3
options nodate nonumber ps=200 ls=80 formdlim=' ';
data respire;
input center treatment $ response $ count @@;
datalines;
1 test y 29 1 test n 16
1 placebo y 14 1 placebo n 31
2 test y 37 2 test n 8
2 placebo y 24 2 placebo n 21
;
proc freq order=data;
weight count;
tables center*treatment*response /
nocol nopct chisq cmh;
run;
data stress;
input region $ stress $ outcome $ count @@;
datalines;
urban low f 48 urban low u 12
urban high f 96 urban high u 94
rural low f 55 rural low u 135
rural high f 7 rural high u 53
;
proc freq order=data;
weight count;
tables region*stress*outcome / chisq cmh nocol nopct;
run;
data soft;
input gender $ country $ question $ count @@;
datalines;
male American y 29 male American n 6
male British y 19 male British n 15
female American y 7 female American n 23
female British y 24 female British n 29
;
proc freq order=data;
weight count;
tables gender*country*question /
chisq cmh nocol nopct;
run;
data ca;
input gender $ ECG $ disease $ count;
datalines;
female <0.1 yes 4
female <0.1 no 11
female >=0.1 yes 8
female >=0.1 no 10
male <0.1 yes 9
male <0.1 no 9
male >=0.1 yes 21
male >=0.1 no 6
;
proc freq;
weight count;
tables gender*disease / nocol nopct chisq;
tables gender*ECG*disease / nocol nopct cmh chisq measures;
run;
Statistics and Operations
Research