Hello,
I'm looking to calculate the attrition rate of my unbalanced panel dataset. It spans from 2005 to 2015, and I'm using a monthly time unit so this is 120 periods. Here are some additional details on my data:
Based on a previous post where a similar question was asked, I have tried using the following command to look at whether individuals remain or drop out of the dataset over time:
However, I am admittedly very unfamiliar with looping commands and I'm not sure whether this has achieved what I need it to do. What I essentially want to do is to compare between the months in my dataset to identify which individuals have dropped out over the timespan of my dataset (2005m2 - 2015m1), and subsequently calculate the attrition rate in my dataset.
If anyone could offer any advice or guidance, it would be very much appreciated!
I'm looking to calculate the attrition rate of my unbalanced panel dataset. It spans from 2005 to 2015, and I'm using a monthly time unit so this is 120 periods. Here are some additional details on my data:
Code:
. xtset id mdate panel variable: id (unbalanced) time variable: mdate, 2005m2 to 2015m1, but with gaps delta: 1 month xtdes id: 4006, 5003, ..., 6872003 n = 4248 mdate: 2005m2, 2005m3, ..., 2015m1 T = 120 Delta(mdate) = 1 month Span(mdate) = 120 periods (id*mdate uniquely identifies each observation) Distribution of T_i: min 5% 25% 50% 75% 95% max 93 120 120 120 120 120 120
Code:
. local i=1 . while `i' <121 { 2. bys id: egen test`i' = max(timeid == `i') 3. egen flag`i' = tag(id) 4. local i = `i' + 1 5. }
If anyone could offer any advice or guidance, it would be very much appreciated!
Comment