Hi,
I'm auditing head imaging requests in my hospital. Some patients will have had multiple scans. I have the scan results in long format (Date / ida / Scan type ( MRI / CT) / Request string / Result string ) and I want to stratify my analysis by scan and also report the number of individuals who have had however many scans.
I have tagged the number of occurrences of each unique anonymised id (ida) by date using the code below to give me scan number (snum).
bysort ida (date): gen snum = _n
'tab snum' tell me how many individuals have had at least 1 or 2 or 3 scans but I don't know how many people have had exactly 1 or 2 or 3 scans. I tried reshaping to wide but had to delete all the other variables and it didn't really work. No doubt, Stata 15 includes an elegant solution but for the moment I'm stuck and as ever, I'd be grateful for any help.
Many thanks
Ali
Ophthalmology Registrar, QMC, Nottingham
I'm auditing head imaging requests in my hospital. Some patients will have had multiple scans. I have the scan results in long format (Date / ida / Scan type ( MRI / CT) / Request string / Result string ) and I want to stratify my analysis by scan and also report the number of individuals who have had however many scans.
I have tagged the number of occurrences of each unique anonymised id (ida) by date using the code below to give me scan number (snum).
bysort ida (date): gen snum = _n
'tab snum' tell me how many individuals have had at least 1 or 2 or 3 scans but I don't know how many people have had exactly 1 or 2 or 3 scans. I tried reshaping to wide but had to delete all the other variables and it didn't really work. No doubt, Stata 15 includes an elegant solution but for the moment I'm stuck and as ever, I'd be grateful for any help.
Many thanks
Ali
Ophthalmology Registrar, QMC, Nottingham
Comment