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
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
Comment