Hi Stata gurus, I am trying to mix string and numeric matrices, in order to improve readability, adding horizontal/vertical string headers.
When I append the "header" below, it works
However, when I prepend the "header", it does not work.
any clue? thks
When I append the "header" below, it works
Code:
. mata ------------------------------------------------- mata (type end to exit) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- : labels=("a","b","c","d","e") : (labels',strofreal(diag(1..5),"%2.1f"))\("",labels) 1 2 3 4 5 6 +-------------------------------------+ 1 | a 1.0 0.0 0.0 0.0 0.0 | 2 | b 0.0 2.0 0.0 0.0 0.0 | 3 | c 0.0 0.0 3.0 0.0 0.0 | 4 | d 0.0 0.0 0.0 4.0 0.0 | 5 | e 0.0 0.0 0.0 0.0 5.0 | 6 | a b c d e | +-------------------------------------+
Code:
: ("",labels)\(labels',strofreal(diag(1..5),"%2.1f")) [symmetric] 1 2 3 4 5 6 +-------------------------------------+ 1 | | 2 | a 1.0 | 3 | b 0.0 2.0 | 4 | c 0.0 0.0 3.0 | 5 | d 0.0 0.0 0.0 4.0 | 6 | e 0.0 0.0 0.0 0.0 5.0 | +-------------------------------------+ : end
Comment