How to code output in survival analysis with interval data I have data of several patients with several observation points. At each observation points we test if the patient has a condition (0) or not (1). I want to perform survival analysis on this data but I'm confused on how to represent the output correctly.
Example data could be:
| Patient | Day | Condition | 
-----------------------------
|       A |  30 |         0 |
|       A |  60 |         1 |
|       A |  90 |         1 |
|       B |  80 |         0 |
|       B | 200 |         0 |
|       C |   0 |         1 |

Checking other similar questions such as this or this one I got to
| Patient |    Output | 
----------------------
|       A |       (?) |
|       A |  (30, 60] |
|       A |       (?) |
|       B |  (80, NA) |
|       B | (200, NA) |
|       C |   (NA, 0) |

which I don't know if it is correct. Also, how would we represent the observation with a (?)?
What confuses me the most is the fact that the patients have a different number of observations and they are measured at non-regular points. In this fashion I selected as "Day 0" the date of the first observation of all the patients. However, if a patient has the condition on its first observation (lets say day 10) I don't think it is correct to code it as (0, 10) but rather (NA, 10). 
Any help would be appreciated.
 A: It looks like you're on the right track. Modeling recurrent event survival times is hard. 
One tweak: it looks like patient B is recruited at time 80 and followed until time 200 then he or she is censored because they did not experience the outcome. If that is the case, you will need to set-up a survival record to indicate that interval of time. I do not know how the software you are dealing with handles records of the form (80, NA) and (200, NA). My hunch is that they're discarded: this info tells us "well we know patient B didn't have the outcome at 80 or 200". My response would be "so what? could've happened at 81 or 80.1 or 80.001." So your code and the intuition are not aligned there. They contribute no person-years' exposure to the denominator of the outcome (risk or incidence).
Before turning to the patient C question, I want to underscore: there's a subtle distinction between modeling the risk of the event and the incidence of the event. Modeling risk means that a patient experiences the event once and they are censored for any later observations. 
You've modeled risk here. Modeling incidence on the other hand, means that the third record for Patient A would include time from 60 to 90 and another outcome of 1. 
To answer whether you model risk or incidence is a matter of the scientific question and not the data. At times, risk and incidence can lead to conflicting conclusions. This happens with not-rare events, especially when many events happen in the same person. When modeling incidence, people with many events have a greater influence on analyses.
Putting that aside, your question about patient C bears out for either modeling approach. The requirements of survival analysis are that patients must be recruited while they are at-risk for the outcome. This means that your patient C was not recruited while at-risk, but in fact found at a time indistinguishable from the beginning of the study, and unfortunately must be omitted from analyses. Otherwise, their contribution to the hazard function is infinite and Patient C's shared risk factors with other patients who do or do not have the disease may lead to strong influence on the whole analysis.
