When the number of spatial units n increases, the amount of memory that it takes to store entries of the spatial contiguity matrix
or the spatial weights matrix
increases dramatically. To circumvent the storage issue, PROC SPATIALREG enables you to provide a compact representation of
(or
) when appropriate. With the compact matrix representation, you provide a data set that contains three variables by using the WMAT= option. The first two variables identify the row r and column c of
(or
), and
can be expressed either as numerical indices or as values of the variable specified in the SPATIALID statement. The third variable contains the nonzero value of
(or
) for row r and column c. With this compact representation, the number of observations in the data set specified in the WMAT= option equals the total number of nonzero entries in
(or
).
You must use a SPATIALID statement if you want to use the compact representation of the spatial contiguity or spatial weights matrix. With the compact representation, the first two variables of the data set that you specify in the WMAT= option must be of the same type. First, the first two columns in that data set can be row and column index for each nonzero entry in (or
). In this case, the SPATIALID variable is numeric type. Alternatively, the first two columns in the WMAT= data set can be characters that are the names of two neighboring spatial units in
(or
). In this second case, the SPATIALID variable is character type.
For example, the compact representation of the spatial weights matrix ,
would look like the following:
data Ws;
input SID cSID Weight;
datalines;
1 2 0.5
1 4 0.5
2 1 1.0
3 4 1.0
4 1 0.5
4 3 0.5
;
run;
For the spatial contiguity matrix ,
the compact representation would look like the following:
data Cs;
input SID cSID Weight;
datalines;
1 2 1.0
1 4 1.0
2 1 1.0
3 4 1.0
4 1 1.0
4 3 1.0
;
run;
If the spatial weights matrix is the same as matrix in the section k-Order Binary Contiguity Matrices, its compact representation would be as follows:
data Ws2;
input SID $ cSID $ Weight;
datalines;
L1 L2 0.5
L1 L4 0.5
L2 L1 1.0
L3 L4 1.0
L4 L1 0.5
L4 L3 0.5
;
run;
If the spatial contiguity matrix is the same as matrix in the section k-Order Binary Contiguity Matrices, its compact representation can be given in the data set
Cs2 as follows:
data Cs2;
input SID $ cSID $ Weight;
datalines;
L1 L2 1.0
L1 L4 1.0
L2 L1 1.0
L3 L4 1.0
L4 L1 1.0
L4 L3 1.0
;
run;