gsort id -graftno;gen yr_2 = yr;by id: replace yr_2 =  yr_2[_N]
Cause of graft failure
Other causes of graft failure
RECODE of timelosttx
sort id graftno; gen timelosttx_cl3= timelosttx_cl2; bys id: replace timelosttx_
gsort id -graftno;gen causdeth_2 = causdeth;by id: replace causdeth_2= causdeth_
gsort id -graftno;gen prd_2 = prd_new;by id: replace prd_2 =  prd_2[_N]
gsort id -graftno;gen agerrt_2 = agerrt;by id: replace agerrt_2= agerrt_2[_N]
Sex
Racial origin
Was native kidney biopsied?
Weight at RRT entry (kg)
Late referral seen <3 mths before 1st treatment
Chronic lung disease
Coronary artery disease
Peripheral vascular disease
Cerebrovascular disease
Diabetes
1=current;2=former;3=never
RECODE of testdiabetes (Diabetes)
RECODE of testlung (Chronic lung disease)
RECODE of coronarytest (Coronary artery disease)
RECODE of testpvd (Peripheral vascular disease)
RECODE of testcvd (Cerebrovascular disease)
RECODE of testreferral3 (Late referral seen <3 mths before 1st treatment)
Graft survival time (days)
Disease in graft kidney
Age at transplant
Transplant status 0=functioning, 1=graft lost
Vital status at last follow-up, 0=alive, 1=dead
Patient survival time (days)
Recipient EBV antibody status
Donor source
Donor sex
HLA-A mismatch
HLA-B mismatch
HLA-DR mismatch
Maximum cytotoxic antibodies
Current (At transplant) antibodies
RECODE of timerectx
gen timerrttx= (txdate_y - initrxdate)if First_RRT_2!=1 in days
gen timelosttx2= txdate- firstkdate
RECODE of timelosttx2
gen timerectx2= txdate - firstjdate
gen timerrttx= (txdate_y- initrxdate) in days
gen died_y= (deathdate_2!=.)
gen timerrtlost = (firstkdate - initrxdate ) in days
gen timerrtrec = (firstjdate - initrxdate) in days
gen timerrtdeath = ( deathdate_2 - initrxdate) in days
gen timerrtextract = extractdate - initrxdate  in days
gen timereclost = (firstkdate- firstjdate) in days
gen timerecdie= deathdate_2 - firstjdate
gen timelostdie= deathdate_2- firstkdate
recode from timerrtrec, 1, <=90d; 2,90.5/180d; 0,>180d
gen txperiodyear= txperiod/365.25
gen timerectx2year= timerectx2/365.25
gen timelosttx2year= timelosttx2/365.25
gen timetxdie2year= timetxdie2/365.25
gen timetxfail= faildate_y- txdate_y
gen graftfail= causfail!=. | faildate_y!=.
gen timetxfailyear= timetxfail/365.25
gen timetxextract = extractdate - txdate_y  in days
gen timetxextractyear =timetxextract/365.25 in years
gen recovery_ycltx= eventtx_y==1
gen lost_ycltx= eventtx_y==2
gen graftfail_ycltx= eventtx_y==3
gen died_ycltx= eventtx_y==4
0=alive; 1=tansplant(no matter die or not); 2=recovery(timerectx ==.); 3=lost to
gen recovery_ycl=event_y==2
gen lost_ycl=event_y==3
gen died_ycl=event_y==4
gen recovery_ycl2 =(event_y==2& timerrtrec <182.625)
recode from agerrt_2; 0,18-29;1,30-39;2,40-49; 3, 50-59; 4, 60-69; 5, >=70
RECODE of sex_new (1=femal;2=male)
RECODE of yr_2 (gsort id -graftno;gen yr_2 = yr;by id: replace yr_2 =  yr_2[_N])
RECODE of bmi_y
RECODE of race (Racial origin)
RECODE of causdeth_2 (gsort id -graftno;gen causdeth_2 = causdeth;by id: replace
gen followtime_y from event_y; 0, alive through; 1, trans; 2, recovery; 3, lost
gen causdeth_22=causdeth_2; replace causdeth_22 = 493 for HD and 492 for PD or t
recode from age2; 0,18-29;1,30-39;2,40-49; 3, 50-59; 4, 60-69; 5, >=70)
recode from donage_y 0, 0-17; 1,18-29; 2, 30-39; 3, 40-49; 4, 50-59; 5, 60-69; 6
recode from donsourc_y; 1=deceased donor;0=living
RECODE of causdeth_22 (gen causdeth_22=causdeth_2; replace causdeth_22 = 493 for
baseline survivor
baseline hazard contribution
gen timetxdie2= deathdate- txdate
0=censored (end of study and lost to followup);1=death;2=competing risk(transpla
0=censored (end of study and lost to followup);1=recovery;2=competing risk( deat
Cumulative Incidence
egen agerrt_re = mean(agerrt_2); gen agerrt_centered= agerrt_2- agerrt_re
recode bmi_cl_y, 2 = 0  Normal;1 = 1 underweight; 3 = 2 Overweight; 4 = 3 Obese
recode race_new_y:1 = 0 European; 2 = 1 Asian;  3 = 2 ATSI; 4 = 3 MPI; 5 = 4 Oth
recode First_RRT_2:3 = 0  HD; 2 = 1 PD; 1 = 2 tx
recode RRT_era if yr_2>1997:4 = 0 1998-2002; 5 = 1 2003-2007; 6 = 2 2008-2013
1=recurrence
year from transplant to recurrence
RECODE of causfail (Cause of graft failure)
gen fail2=causfail_cl==4 (chronic rejection
martingale residual
MN, 1; other GN, 0; the other missing
0=censored (end of study and lost to followup);1=death;2=competing risk(graft fa
0=censored (end of study and lost to followup);1=graft fail;2=competing risk(dea
gen followtime_y2 from event_y; 0, alive through; 1, trans; 2, recovery; 3, lost
***
CI() 95% upper bound
CI() 95% lower bound
gen died_ycltx2= eventtx_y2==4; 1, death without graft failure; 0, others
gen graftfail_ycltx2= eventtx_y2==3, graftfail including death after fail, indee
RECODE of cig_new (1=current;2=former;3=never)
Cumulative Hazard of Death for Patients on Hemodialysis by stcompet twoway after
cvddeath_y2 contains only cardiac, cervd, pvd and other cvd
cvddeath_y contains subclass of cardiac death, and the other three class of deat
RECODE of racenewy_recl (recode race_new_y:1 = 0 European; 2 = 1 Asian;  3 = 2 A
last cause of graft fail
stcompet ciftxfa for death censored graft failure after stcrreg without tvc 1963
stcompet ciftxfa02 for death censored graft failure after stcrreg without tvc 19
recode from donage_y: 0,18-29; 1,0-17; 2, 30-39; 3, 40-49; 4, 50-59; 5, 60-69; 6
RECODE of ischemia_y (gen ischemia_y= ischemia;replace ischemia_y= ischemia_y[_n
RECODE of maxcyto (Maximum cytotoxic antibodies)
RECODE of currcyto (Current (At transplant) antibodies)
from First_RRT_2: 0, Dialysis; 1, Transplant
gen agetx98_centered= age - 49, median of age is 49 if txdate_y!=. & yr_2>1997
gen bmiy98_centered= bmi_y- 25.47, median of bmi_y is 25.47 if txdate_y!=. & yr_
gen agetx_centered= age - 46, median of age is 46 if txdate_y!=.
gen bmiy_centered= bmi_y- 24.85, median of bmi_y is 24.85 if txdate_y!=.
(donsourc_type>=.)
(bmiy_recl>=.)
(referral_new3>=.)
(cig_new>=.)
(diabetes_new>=.)
1 if record is to be used; 0 otherwise
1 if failure; 0 if censored
analysis time when record ends
analysis time when record begins
gen bmiy98dia_centered= bmi_y- 26.45 if First_RRT_2!=1 & yr_2>1997, median of bm