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
How to convert string id variable starting with "00" to numeric without losing the "00"?Hi, could any one help me with the following two issues? First, my id variable values start with 00…
Scatterplot with weighted regression line using aaplot and lfitDear Statalist, I'm trying to graph a scatterplot with a regressionline. Instead of a standard OLS …
Observations with missing cells in the data - should they be dropped?Hi all. I am organizing a panel data with information on the spending with government advertising by…
xttest0 invalid syntax R(111)Hello, I'm using stata 16 This is my code, Code: xtset com_id date, daily * LM test for penal wise…
how to create histogram for sub-samples by year averages?Dear all, I use Stata16 and will appreciate any help with creating comparative histogram by the 5-y…
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