I am trying to get label names from a tabstat matrix, I am using tabstatmat ado, an example of my code is:
Code:
sysuse auto,clear egen both = group(foreign rep78), label tabstat foreign, by(both) s(n) save tabstatmat x, nototal x[8,1] foreign Domestic 1:N 2 Domestic 2:N 8 Domestic 3:N 27 Domestic 4:N 9 Domestic 5:N 2 Foreign 3:N 3 Foreign 4:N 9 Foreign 5:N 9 mata: slct = ((sumat=st_matrix("x")) :== colmax(sumat))[.,1] mata: namerow= select(st_matrixrowstripe("x"), slct)[1,1] mata: st_local("rowname", namerow) tokenize "`rowname'" di "`1'" Domestic 3
Code:
di "`1'" Domestic di "`2'" 3
Regards
0 Response to Problem with tokenize a local variable using mata and tabstatmat
Post a Comment