Dear all,

I'm hoping for some advice re. creating a 'failure" variable for a survival (or time till event) analysis I'm working on.

We're looking at intraocular pressure (IOP) after surgery.
"Failure" is either (i) IOP >21, (ii) IOP <20% decrease from first IOP, or (iii) re-operation.

I have my data in long format, where IOP's are documented (_iop), time from first op calculated (iop_days), and observations since a unique surgery numbered (iop_no), using
Code:
bysort patient_guid _date (iop_date): gen iop_no = _n
I have merged them to unique patient IDs, using the merge m:m function.

I hope the screenshot (attached) is of help.

I would really appreciate any advice anyone has for me, regarding creating these failure variables.
Thanks very much for your time, and consideration.
Array
Will