* * read in the URSO data set * ; libname save 'sasdata'; data temp; infile 'data.urso'; input id rx entry lastfu hi_stage bili risk death trans withdraw histprog varices ascites ence bili_2 worse; informat entry lastfu death trans withdraw histprog varices ascites ence bili_2 worse date7.; format entry lastfu death trans withdraw histprog varices ascites ence bili_2 worse date7.; data save.urso1; *time to first event; set temp; keep id rx hi_stage bili risk futime status entry; first = min(death, trans, withdraw, histprog, varices, ascites, ence, bili_2, worse); if (first=.) then do; futime = lastfu - entry; status =0; end; else do; futime = first - entry; status =1; end; data save.urso2; *time to all events; set temp; keep id rx hi_stage bili risk futime status etype; array dt death trans withdraw histprog varices ascites ence bili_2 worse; do i=1 to 9; etype =i; if (dt[i] =.) then do; futime = lastfu - entry; status =0; end; else do; futime = dt[i] - entry; status =1; end; output; end; * * repeat this, but ignoring voluntary withdrawal; *; data save.urso3; *time to first event; set temp; keep id rx hi_stage bili risk futime status entry nevent; nevent = sum(death/death, trans/trans, histprog/histprog, varices/varices, ascites/ascites, ence/ence, bili_2/bili_2, worse/worse); if (nevent=.) then nevent=0; first = min(death, trans, histprog, varices, ascites, ence, bili_2, worse); if (first=.) then do; futime = lastfu - entry; status =0; end; else do; futime = first - entry; status =1; end; data save.urso4; *time to all events; set temp; keep id rx hi_stage bili risk futime status etype; array dt death trans histprog varices ascites ence bili_2 worse; do i=1 to 8; etype =i; if (dt[i] =.) then do; futime = lastfu - entry; status =0; end; else do; futime = dt[i] - entry; status =1; end; output; end;