Suppose I wish to rename the rows of a matrix.
In this case, I want row 1 to be named "City God Temple" and row 2 to be "Songjiang". How would I do this? Instead, at present, it concatenates them together.
EDIT: Okay so I have the answer (dug up from some code in my program), but I don't get why it's correct.
Why does this work? Is it the backticks that levelsof defines?
Code:
clear * cls matrix A = (2,1\3,2) cls loc rn foreach i in "City God Temple" Songjiang { // local rn `rn' `:display "`i'' di "`rn'" } matrix rownames A = "`rn'" mat l A
EDIT: Okay so I have the answer (dug up from some code in my program), but I don't get why it's correct.
Code:
clear * cls u "http://fmwww.bc.edu/repec/bocode/s/scul_Reunification.dta", clear matrix A = (2,1\3,2) levelsof country if inlist(code,20,21), l(labs) mat rownames A = `labs'
Comment