Hi , there are 20 patients. they are assigned to two physicians(P1 and P2) to evaluate 3 disease (a,b,c) 1=disease,0=no disease
to test the difference for for physicians performance for disease p1-a and p2a, I can use mcnemar test. how can I test overall difference between p1 and p2 by combining the 3 diseases? thank you!
id | p1-a | p1-b | p1-c | P2-a | p2-b | p2-c |
1 | 0 | 0 | 0 | 0 | 0 | 0 |
2 | 0 | 0 | 0 | 0 | 0 | 0 |
3 | 0 | 0 | 0 | 1 | 1 | 0 |
4 | 0 | 0 | 0 | 0 | 0 | 0 |
5 | 0 | 0 | 0 | 0 | 0 | 0 |
6 | 0 | 0 | 1 | 1 | 1 | 0 |
7 | 0 | 0 | 0 | 1 | 1 | 1 |
8 | 0 | 0 | 0 | 0 | 0 | 0 |
9 | 0 | 0 | 0 | 1 | 0 | 0 |
10 | 0 | 0 | 0 | 0 | 0 | 0 |
11 | 0 | 0 | 0 | 0 | 0 | 0 |
12 | 0 | 0 | 0 | 1 | 1 | 0 |
13 | 0 | 0 | 0 | 0 | 0 | 0 |
14 | 0 | 0 | 0 | 0 | 0 | 0 |
15 | 0 | 0 | 0 | 1 | 1 | 0 |
16 | 0 | 0 | 0 | 0 | 0 | 0 |
17 | 0 | 0 | 0 | 0 | 0 | 0 |
18 | 1 | 0 | 0 | 0 | 0 | 0 |
19 | 1 | 0 | 0 | 1 | 1 | 0 |
20 | 0 | 0 | 0 | 1 | 0 | 0 |
You'd need to re-arrange your data in such a way that it can be more easily analyzed by SAS PROCs
Something like this:
id physician disease outcome 1 1 A 0 1 1 B 0
Then PROC LOGISTIC and/or PROC FREQ can do the statistical tests easily. In PROC LOGISTIC, your model would contain Physician and disease and the interaction between the two.
for test difference between p1a and p2a,
i use following codes
proc freq data=p1 order=data;
tables p1a*p2a / agree ;
test kappa;
run;
however, how to test overall difference between (p1a p1b p2c) and (p2a p2b p2c), thank you!
Yes, like PaigeMiller said, you can rearrange your input data. Then a TABLES request like this
proc freq;
tables Disease * P1_Rating * P2_Rating / agree;
produces an overall kappa coefficient (summing over the 3 diseases) together with agreement statistics for each disease.
what is the sas code to rearrange the data above? thank you!
A data step can be used to transform your data.
data transposed;
set have;
length
physician disease $ 1 outcome 8
i 8 name $ 32
;
/* variable to be excluded from the dataset transposed */
drop i name p1_a p1_b p1_c p2_a p2_b p2_c;
/* array allows easier processing of the p-variables */
array old[6] p1_a p1_b p1_c p2_a p2_b p2_c;
do i = 1 to dim(old);
/* get the name of the variable, returns p1_b if i = 2 */
name = vname(old[i]);
/* extract physician and disease from the variable name */
physician = substr(name, 2, 1);
disease = substr(name, 4, 1);
/* copy the value to the variabel outcome */
outcome = old[i];
output;
end;
run;
EDIT:
It makes suggesting code much easier if data is presented in usable form. Those tables look nice, but not nice to move to sas-code. This form is usable:
data have;
input id p1_a p1_b p1_c p2_a p2_b p2_c;
datalines;
1 0 0 0 0 0 0
2 0 0 0 0 0 0
3 0 0 0 1 1 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
6 0 0 1 1 1 0
7 0 0 0 1 1 1
;
run;
Please note that i was to lazy to write down all rows you have in the table.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.