BookmarkSubscribeRSS Feed
lucamerlini
Calcite | Level 5

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

4 REPLIES 4
lucamerlini
Calcite | Level 5

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

ChanceTGardener
SAS Employee

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. 

SASCom1
SAS Employee

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.

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Multiple Linear Regression in SAS

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.

Discussion stats
  • 4 replies
  • 452 views
  • 1 like
  • 4 in conversation