 mata mata clear
 mata 
: function RMFTdiff(at) {\lbr}
2.   return((at[1]:+at[2]:+at[3]) :- (at[4]:+at[5]:+at[6]))
3. {\rbr}
{\smallskip}
: end
{\smallskip}
 standsurv if first, at1(${\lbr}cancer_mostdep_stand{\rbr}) ///
>   at2(${\lbr}cvd_mostdep_stand{\rbr}) ///
>   at3(${\lbr}other_mostdep_stand{\rbr}) ///
>   at4(${\lbr}cancer_leastdep_stand{\rbr}) ///
>   at5(${\lbr}cvd_leastdep_stand{\rbr}) ///
>   at6(${\lbr}other_leastdep_stand{\rbr}) ///
>   atvars(LYLcancer_stand_mostdep LYLcvd_stand_mostdep ///
>   LYLother_stand_mostdep LYLcancer_stand_leastdep ///
>   LYLcvd_stand_leastdep LYLother_stand_leastdep) ///
>   userfunction(RMFTdiff) userfunctionvar(RMFT_diff) ///
>   failure timevar(tempt) ci
