Hello, I am new to SAS and am having trouble creating my dataset so it fits a time varying cox model and I am in desperate need for help. My dataset looks as following; Vx_State = a categorical variable, if 1 it stays in that state rest of the study Vx_Date = Date when the variable changes from 0 to 1 t1 = starting time in days for that row t2 = ending time in days for that row ID Start_date End_date V1_State V1_Date V2_State V2_Date V3_State V3_Date V4_State V4_Date t1 t2 1 2010-01-15 2013-12-31 0 2012-05-19 1 . 0 2010-11-15 1 . 1 1446 2 2010-05-13 2012-10-07 1 . 0 . 1 . 0 2012-08-17 1 878 . . . x But I want to split the rows for each time a variable (Vx_State) changes by the patient ID ; ID Start_date End_date V1_State V1_Date V2_State V2_Date V3_State V3_Date V4_State V4_Date t1 t2 1 2010-01-15 2010-11-14 0 2012-05-19 1 . 0 2010-11-15 1 . 1 303 1 2010-11-15 2012-05-18 0 2012-05-19 1 . 1 2010-11-15 1 . 304 853 1 2012-05-19 2013-12-31 0 2012-05-19 1 . 1 2010-11-15 1 . 854 1446 I hope that my problem fairly clear, at least, and any help would be appreciated! Best Regards
... View more