I am trying to run the following code:

Code:
//create the dataset for the forestplot.
matrix ipd = male\female\white\african\asian\nodm\yesdm\nolkd\yeslkd\nolanbar\yeslanbar

clear
svmat ipd
svmat NN

format ipd1 ipd2 ipd3 ipd4 ipd5 ipd6 NN %9.0g
format ipd7 %4.0g
Where male, female, white, african, etc. are set up as

Code:
stset true_followupdt, failure(had_LD == 1) origin(refer_date) scale(365.25) id(mrn)
fvset base 1 age_cat
qui stcox  i.age_cat i.race_group_used i.hist_dm i.lkd_at_referral i.commu_english2 i.marital_status3 i.margindex i.employment2 i.hist_cad_mi i.abo i.had_previous_ktx i.rsex##i.age_cat if rsex == 0
matrix rtable = r(table)

mat male = 1, 1, 1, rtable[1,1], rtable[5,1], rtable[6,1], 0\1, 1, 2, rtable[1,2], rtable[5,2], rtable[6,2], 0\1, 1, 3, rtable[1,3], rtable[5,3], rtable[6,3], 0

forvalues i = 1/3 {
    matrix male[`i',7] = ${rsex}
    }
On running the first block of code I'm getting variable NN not found r(111) error. I haven't used svmat before so I'm not sure if I'm doing something wrong or if it's even the correct usage for it. I would appreciate any help. Thanks!