Hello members,
I have a variable "pathogen" indicating about what pathogen it is all about and the the variable "patient_id" indicating the index patients with this pathogen and a third variable "contact_positive" indicating if a contact person was either tested negative (0) or positive (1) (who was in contact with the index patient).
I would now like to know, sorted by pathogen, what is the percentage of contact_positive=1 per patient and then calculate the mean out of these percentages.
Can you please help me with that? Thank you!
I have a variable "pathogen" indicating about what pathogen it is all about and the the variable "patient_id" indicating the index patients with this pathogen and a third variable "contact_positive" indicating if a contact person was either tested negative (0) or positive (1) (who was in contact with the index patient).
pathogen | patient_id | contact_positive |
1 | 55 | 0 |
1 | 55 | 0 |
1 | 55 | 0 |
1 | 55 | 1 |
1 | 57 | 1 |
1 | 57 | 0 |
1 | 58 | 1 |
1 | 60 | 0 |
1 | 60 | 0 |
1 | 60 | 0 |
2 | 60 | 0 |
2 | 60 | 1 |
2 | 62 | 0 |
2 | 62 | 1 |
Can you please help me with that? Thank you!
Comment