Hello SAS Community,
I am currently working on a project where I need to utilize PROC COUNTREG in SAS, particularly focusing on utilizing a weight matrix (WMAT) in a compact form. I have a WMAT with a dimension of 139,000*139,000 which is highly sparse (only 15 values per rows). I would use a matrix in a compact form to save space with three columns. The first two columns give the row and column indices for nonzero entries in the spatial weights matrix. The third column in the data set contains the nonzero entries in the spatial weights matrix. This option is already present in PROC SPATIALREG(proc spatialreg pages2355-2356 ), it is possible to adapt this feature even in PROC COUNTREG?
Has anyone ever had this problem?
Could anyone please provide share some insights on how to properly utilize the WMAT in a compact form within PROC COUNTREG?
Any examples, tips, or resources you could share would be greatly appreciated. Thank you in advance for your assistance!
Best regards,
Luca
Hello SAS Community,
I am currently working on a project where I need to utilize PROC COUNTREG in SAS, particularly focusing on utilizing a weight matrix (WMAT) in a compact form. I have a WMAT with a dimension of 139,000*139,000 which is highly sparse (only 15 values per rows). I would use a matrix in a compact form to save space with three columns. The first two columns give the row and column indices for nonzero entries in the spatial weights matrix. The third column in the data set contains the nonzero entries in the spatial weights matrix. This option is already present in PROC SPATIALREG(proc spatialreg pages2355-2356 ), it is possible to adapt this feature even in PROC COUNTREG?
Has anyone ever had this problem?
Could anyone please provide share some insights on how to properly utilize the WMAT in a compact form within PROC COUNTREG?
Any examples, tips, or resources you could share would be greatly appreciated. Thank you in advance for your assistance!
Best regards,
Luca
The compact form you're describing is called an edge list, and you're correct that in SPATIALREG you can simply input an edge list with non-zero element values and SPATIALREG will convert it into the NxN spatial weights matrix behind the scenes for you and normalize it.
I checked the doc and am unclear if you can read the spatial weights matrix in edge list format into COUNTREG.
If not, a more user-friendly workaround with sparse W matrices is to start with an edge list containing only non-zero elements, use SAS to convert it into an NxN spatial weights matrix, then read it into COUNTREG.
That's how I used SPATIALREG for years until I realized it accepted edge lists.
Hello @lucamerlini
Unfortunately PROC COUNTREG does not accept compact form of the WMAT matrix as does PROC SPATIALREG. Sorry I do not have better news for you at this time.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.