Hi all,
I have a set of 50 matrices derived from outputs run for 50 variables with the same names. I am trying to combine these matrices to put them in an excel sheet. As an example, this is how I have combined 4 of them:
I have used different versions of this combined matrix and the variable names throughout my code, so rather than retyping the names of all the variables and matrices each time, I would like to include them in a local macro, like this:
I can get the local macro to add a \ after each matrix name, but I'm not sure how to get it to display all of the matrix names with the separator between them in a new local macro. This might also not be the best way of doing this, so any suggestions appreciated!
Thanks,
Sonia
I have a set of 50 matrices derived from outputs run for 50 variables with the same names. I am trying to combine these matrices to put them in an excel sheet. As an example, this is how I have combined 4 of them:
Code:
matrix comb = (h_region \ h_wealth \ h_urban \ m_edu)
Code:
local x_all = "h_region h_wealth h_urban m_edu"
foreach x in `x_all' {
local `x'n = "`x' \ "
di "``x'n'"
}
di "``x'n'"
matrix x_all = ("``x'n'")
matrix list x_all
matrix comb = (h_region \ h_wealth \ h_urban \ m_edu)
matrix list comb
Thanks,
Sonia

Comment