I have a list of patients with 1-6 visits each. At each visit, a score is registered (integer from 1-6).
I wish to count for each patient the number of times they obtain at particular score, e.g. of 3.
And tabulate how many patients obtain a score of 3 once, twice, etc.
I have tried this:
bysort PatientID: egen numberOfScoresEqualTo3=count(Score==3)
But STATA keeps counting all the visits, no matter what the score is. E.g. a patient with 4 visits will be counted as 4 despite having obtained a score of 3 only twice.
What is wrong? It seems such a simple problem!
Thanks for any help or alternative suggestions!
I wish to count for each patient the number of times they obtain at particular score, e.g. of 3.
And tabulate how many patients obtain a score of 3 once, twice, etc.
I have tried this:
bysort PatientID: egen numberOfScoresEqualTo3=count(Score==3)
But STATA keeps counting all the visits, no matter what the score is. E.g. a patient with 4 visits will be counted as 4 despite having obtained a score of 3 only twice.
What is wrong? It seems such a simple problem!
Thanks for any help or alternative suggestions!
Comment