BookmarkSubscribeRSS Feed
david-ck
Calcite | Level 5

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!

 

idp1-ap1-bp1-cP2-ap2-bp2-c
1000000
2000000
3000110
4000000
5000000
6001110
7000111
8000000
9000100
10000000
11000000
12000110
13000000
14000000
15000110
16000000
17000000
18100000
19100110
20000100
5 REPLIES 5
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
david-ck
Calcite | Level 5

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!

Watts
SAS Employee

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.

david-ck
Calcite | Level 5

what is the sas code to rearrange the data  above? thank you!

andreas_lds
Jade | Level 19

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.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 5 replies
  • 1023 views
  • 2 likes
  • 4 in conversation