Hi,

I was hoping to get some advice on identifying consecutive failures in panel data.

I am looking at outcomes of operations to lower pressure in the eye to treat glaucoma. I am interested in identifying individuals who have intraocular pressure (iop) >18 on 2 consecutive occasions. Is this possible ?

I’ve enclosed a simplified example dataset, showing what I’m trying to achieve (fail column)

Thanks (and Merry Xmas)

Ali

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte(id visit) int(date_of_surgery date_postop) byte(iop fail) float td byte(_st _d) int _origin byte(_t _t0)
1 1 21640 21642 15 .  2 1 0 21640  2  0
1 2 21640 21643 19 0  3 1 0 21640  3  2
1 3 21640 21644 17 .  4 1 0 21640  4  3
1 4 21640 21645 19 0  5 1 0 21640  5  4
2 1 21645 21646 16 .  1 1 0 21645  1  0
2 2 21645 21647 20 .  2 1 0 21645  2  1
2 3 21645 21648 20 1  3 1 1 21645  3  2
2 4 21645 21649 12 .  . 0 . 21645  .  .
3 1 21640 21650 13 . 10 1 0 21640 10  0
3 2 21640 21651 13 . 11 1 0 21640 11 10
3 3 21640 21652 15 . 12 1 0 21640 12 11
end
format %tdnn/dd/CCYY date_of_surgery
format %tdnn/dd/CCYY date_postop