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
Stata dataset to latex tableI have a dataset in stata that looks like this: quintile mean t_stat 1 0.0100 4.100 2 0.0200 4.200 …
Help with reshaping the dataDear community, I am trying to bring some data into a different format. The data is World Uncertain…
[LASSO] Collinear covariates: Suggested addition to the documentationI would like to suggest an addition to the documentation for collinear covariates in LASSO models. T…
Show the working directory and save it in a macroHi~ I can use command cd or pwd to show the working directory. But how can I save the returned resul…
How to weight data using CPS weights in STATA?Hello, I have CPS monthly data 2015-present. I want to calculate unemployment rate. I am using emps…
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