Hello everyone! I've been struggling for a few days to solve the this task. The setting/study - Observational data. Patients with Crohns Disease. Data was collected annually during 2002–2013 in a large region in Sweden. - Patients can be included any year and visits may be irregular on a annual basis (some patients might visit the clinic every year, other come only one time during the study period). - I know the exact day of death for each patient. VARIABLE: DEATH_YEAR - I know the exact day of relapse (one of the endpoints of interest). VARIABLE: RELAPSE_YEAR I am interested in the incidence of relapse and I need to calculate the number of relapses each year divided by the number of individuals alive that year. Now the problem is that from inclusion, individuals come irregularly, but I do know if they are actually alive that year and if they have experienced a relapse. I could solve this (if I only could...) if I could create 12 new variables for each patient. Each new variable should be the calendar year and this variable should be set to '1' if the patient is alive that year. Thus the problem is that i need to create a 'year-variables' that are set to '1' for each year at inclusion and thereafter, given that the person is not dead, or has experienced the event. An example: Patient X was included 2005 and died 2009. For him I would need he following variables: '2005', '2006', '2007', '2008' and '2009' set to '1'. Patient Y was included 2005 and experienced event 2007. For him I would need the following variables: '2005', '2006', 2007' set to '1'. (Yes, year of event/death need still be set to '1'). I would be extremely grateful for any advice on this! Thanks in advance! /adam
... View more