I have a code that partially works to create a spatial matrix:
egen id = group(IOCode),label lname(IOCode)
spset id
local var v1 v2 v3 v4 v5
mata: st_matrix("c",st_data((1,5),"`var'"))
matrix coln c= `var'
mat list c
spmatrix spfrommata Wmat=c id
Although mat list c shows the matrix, spmatrix leads to the error: matrix c not found
I've also tried:
. local var v1 v2 v3 v4 v5
. mata:
------------------------------------------------- mata (type end to exit) ----------------------------------------------------------------------------------------------------------------
:
: id = st_data(., "_ID")
:
: c = st_matrix("c",st_data((1,5),"`var'"))
:
: end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.
. spmatrix spfrommata myIdist = c id
with the error: number of rows in matname must be > 0
Related Posts with Create and export spatial matrix: spmatrix does not find the matrix created in Mata
Calculating birthdate from age and age at test dateHow do I calculate birthdate from the age at test date (ageIGA) and the test date (tvdIGA)? Variabl…
logistic regression standard errorsHi All, When I run the logit command I get the following result outcome | Coef. Std. Err. z P>|…
Kaplan meier survival analysisplease, guys, I want to perform a Kaplan Meier survival analysis with stata, someone could help me??…
plotting means + cis using imputed data and coefplotHi everyone, I hope you'll be able to help me with this question. I have multiple years of cross-se…
Assigning labels as variable valuesI am using encode to convert a variable from string to numeric type so that I can use it in a regres…
Subscribe to:
Post Comments (Atom)
0 Response to Create and export spatial matrix: spmatrix does not find the matrix created in Mata
Post a Comment