Hi everyone.
I am trying to figure out the code for survival analysis. I have watched some videos online and read on this topic and was able to pull up the basic codes and I am stuck.
I have 1 year data for patients with colorectal carcinoma CRC defined by a varaible called pt_int=1 if they had the diagnosis of CRC in any of their admission. Each patient had a unique id called (visitlink) and has multiple ED (defined by a variable called ed=1) and hospital admissions (defined by a variable pt_interest=1). I also generated a variable to identify the admission of interest and I called it (indexadmission=1). The subsequent ed and hospital admission are identified by pt_era=2 where the indexadmission has a pt_era=0 and I want to conduct the survival analysis for only patients who had indexadmission=1 during the period (july to september) defind by a variable called amonth=7 or 8 or 9 and look at 30 days survival, 90 days survival.
I have two time variables which are (daystoevent) which is a number that changes with each admission. for example patient 1 was admitted on daystoevent 12001 and the next admission was around 25 days later so the daystoevent for the subsequent admission would be 12026. So from this variable I generated a new variable called (timetonextadmission) which is equal to 0 in the indexadmission and is equal to the deference between the daystoevent between the index and subsequent admission for the all admissions that come after the indexadmission.
The event variable is died=1 if the patient died during any of the admissions. (side questions, should I exclude those who died on the indexadmission?)
I also generated a scoring variable called lace_risk which is equal to either 1 or 2 or 3 based on the comorbidities of the patient and I want to generate like a KM survival curve for that at the end.
so how can in incorporate all of this information into a survival analysis?
I would really appreciate all the help.
Thanks in advance.
I am trying to figure out the code for survival analysis. I have watched some videos online and read on this topic and was able to pull up the basic codes and I am stuck.
I have 1 year data for patients with colorectal carcinoma CRC defined by a varaible called pt_int=1 if they had the diagnosis of CRC in any of their admission. Each patient had a unique id called (visitlink) and has multiple ED (defined by a variable called ed=1) and hospital admissions (defined by a variable pt_interest=1). I also generated a variable to identify the admission of interest and I called it (indexadmission=1). The subsequent ed and hospital admission are identified by pt_era=2 where the indexadmission has a pt_era=0 and I want to conduct the survival analysis for only patients who had indexadmission=1 during the period (july to september) defind by a variable called amonth=7 or 8 or 9 and look at 30 days survival, 90 days survival.
I have two time variables which are (daystoevent) which is a number that changes with each admission. for example patient 1 was admitted on daystoevent 12001 and the next admission was around 25 days later so the daystoevent for the subsequent admission would be 12026. So from this variable I generated a new variable called (timetonextadmission) which is equal to 0 in the indexadmission and is equal to the deference between the daystoevent between the index and subsequent admission for the all admissions that come after the indexadmission.
The event variable is died=1 if the patient died during any of the admissions. (side questions, should I exclude those who died on the indexadmission?)
I also generated a scoring variable called lace_risk which is equal to either 1 or 2 or 3 based on the comorbidities of the patient and I want to generate like a KM survival curve for that at the end.
so how can in incorporate all of this information into a survival analysis?
I would really appreciate all the help.
Thanks in advance.