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
ciplot using listwise deletionDear Stata users, I am using Stata/IC 16.1. I have 4 binary variables (Yes=1 No=0). I want to plot …
Get rid of the space after the leading quote?Hi all, Please see the graph below and the example codes. In the 'note' option in my codes, I have …
How to randomly sampling and regression, and save the output 500 times, and draw kdensity of 500 coeffients?for example, I have a sample of 2000 students from 50 schools. I want to randomly drop 2 schools an…
Prior Event Rate Ratio (PERR) and its confidence intervalDear all, I am trying to calculate Prior Event Rate Ratio (PERR) and its 95% confidence interval in …
How to compare countries in panel data regression?Hi everyone I am comparing variables for 3 countries over 20 years and I would like to have a coeff…
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