* table 2 in paper;

proc format;
	value hstat 1="1: excel" 2="2: good" 3="3: fair" 4="4: poor";
run;

data ps_agree;
input q_pt q_sg frq;
cards;
1 1  25
1 2  63
1 3   0
1 4   3

2 1   0
2 2   0
2 3   0
2 4   0

3 1   7
3 2 122
3 3   0
3 4  40

4 1   1
4 2  21
4 3   0
4 4  66
;
run;
data ps_agree(drop=frq); set ps_agree;
do i=1 to frq;
output;
end; drop i;
format q_pt q_sg hstat.;
run;

TITLE "Incorrect"; run;
proc freq;
	tables q_pt*q_sg /kappa;
run;

TITLE "Correct using wkappa macro"; run;

%include 'wkappa.txt';

%kappa(q_pt, q_sg, 4, 1, uwt, 95, ps_agree);