I am working with the matrix coding of stata, which is new to me, and I am struggling with a simple question. I looked up on google and searched everywhere, but I still do not find a solution. I hope here someone can help me.
Basically, I am creating a let's say 4x2 matrix that we can call mymatrix. Then I name the 2 columns of the matrix as "a" and "b".
I wish to assign values at the corresponding row and column using the name of the columns instead of their "number". Therefore the code I would like to have should look like this:
Code:
clear all mat mymatrix = J(4,2,.) mat colnames mymatrix=a b mat mymatrix[1,"a"] = 4 mat mymatrix[1,"b"] = 5 svmat double mymatrix, name(col)
Does anyone know how I could do this?
Any help or suggestion would much be appreciated!
Thanks to all in advance
0 Response to Matrix codes
Post a Comment