Hello group,
I have a panel data containing violent incidents by patients in a mental health facility. A patient can have multiple admissions. I need to know in which admission the first incident occur. I created
the order_admin variable which is the order of the admission (first, second m third , son admission) . So for the first patient , the first incident occurred in the 3rd admission. So I would like a column with the number 3 for all admissions of that patients.
Thank you in advance,
Marvin
I have a panel data containing violent incidents by patients in a mental health facility. A patient can have multiple admissions. I need to know in which admission the first incident occur. I created
the order_admin variable which is the order of the admission (first, second m third , son admission) . So for the first patient , the first incident occurred in the 3rd admission. So I would like a column with the number 3 for all admissions of that patients.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double admission str9 patientID long number_incidents float order_admin 349150988 "000235" 0 5 349140796 "000235" 0 2 241131237 "000235" 0 1 349150932 "000235" 0 4 141140620 "000235" 1 3 349151105 "000235" 2 6 240140009 "000255" 0 1 241150015 "000255" 2 2 241150843 "000255" 3 3 875150007 "000262" 0 6 875140165 "000262" 0 5 875140131 "000262" 0 4 875150077 "000262" 0 8 825130128 "000262" 0 2 441130892 "000262" 0 1 875140044 "000262" 0 3 875150016 "000262" 1 7 end
Marvin
Comment