 global covlist
 global covlist_tvc
{\smallskip}
 foreach cause in cancer cvd other {\lbr}
  2.   global covlist $covlist _`cause'
  3.   global covlist_tvc $covlist_tvc _`cause'
  4.   foreach cov in mostdep sex rcsage1 rcsage2 rcsage3 {\lbr}
  5.      gen `cov'_`cause' = `cov'*_`cause'
  6.      global covlist $covlist `cov'_`cause' 
  7.      global covlist_tvc $covlist_tvc `cov'_`cause'
  8.   {\rbr}
  9. {\rbr}
{\smallskip}
 di "$covlist"
_cancer mostdep_cancer sex_cancer rcsage1_cancer rcsage2_cancer rcsage3_cancer 
_cvd mostdep_cvd sex_cvd rcsage1_cvd rcsage2_cvd rcsage3_cvd 
_other mostdep_other sex_other rcsage1_other rcsage2_other rcsage3_other
{\smallskip}
 stpm2 $covlist ///
>   , scale(h) tvc($covlist_tvc) knotstvc(${\lbr}knotstvc_opt{\rbr}) ///
>    bknotstvc(${\lbr}bknotstvc_opt{\rbr}) knscale(time) rcsbaseoff eform nocons