Hi all, I have a question.

Recently, I wanted to run the spxtregress command and I checked the Stata manual [SP] Spatial Autoregressive Models.
According to the manual, I need to set my data to be Sp data first. So, I did it and it was very successful.

Then, I have to define the spatial weighting matrix W and the problem occur here.

According to the Stata manual page 119(spmatrix fromdata),
Create spectral-normalized spatial weighting matrix W from the NxN "matrix" stored in variables
Here, I cannot understand the part "stored in variables".

For example, at the first time I thought that if I have 10 variables for 10 observations, I can make the 10x10 spatial weighting matrix like below.
Code:
/* This is an example to explain my understand about the "spmatrix fromdata" command */

clear all

set obs 10

* generate pseudo variables
forvalue i = 1/10 {
gen v`i' = runiform()
}

* generate the id variable and time variable
egen id = seq(), from(1) to(5) b(2)

egen time = seq(), from(1) to(2)

* make the diagonal elements to be zero
replace v1 = 0 if id == 1 & time == 1
replace v2 = 0 if id == 1 & time == 2
replace v3 = 0 if id == 2 & time == 1
replace v4 = 0 if id == 2 & time == 2
replace v5 = 0 if id == 3 & time == 1
replace v6 = 0 if id == 3 & time == 2
replace v7 = 0 if id == 4 & time == 1
replace v8 = 0 if id == 4 & time == 2
replace v9 = 0 if id == 5 & time == 1
replace v10 = 0 if id == 5 & time == 2

* set sp data
assert id != .
assert time != .
bysort id time: assert _N == 1

xtset, clear
xtset id time

spbalance
spset id

* making the spatial weight matrix
spmatrix fromdata Wnew = v1 - v10
But, the last line does not work.

How can I make the spatial weight matrix or what is the meaning of "a matrix stored in variables?

Thank you for your time spending to read this question.