BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
onesasuser
Calcite | Level 5

Hi all, I'm a beginner using SAS to perform network analysis. The data set is represented as the follows:

node 1node 2
31
42
23

Each column represents the id of nodes; each row represents an edge from node 1 to node 2.There are a large amount of nodes, say 200000, Now I want to convert this data set to a 200000 x 200000 adjacency matrix, i.e. each row and each column represents a node, a value 1 is set to row i column j if there is an edge from node i to node j. According to the above table the converted one is like this:

1234
10010
20000
31000
40100


Now my problem is, because the data set is too large, when using SAS IML to create a 200000 x 200000 matrix there is insufficient memory. So I wonder if there is alternatives to create such a big matrix? If it is doable, how could I do it?

Many thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

SAS has a product (SAS Social Network Analysis) for SNA, but it doesn't use SAS/IML.

What you intend to do with the adjacency matrix once you have it?  For a matrix that large, the obvious approch is to use a sparse representation, but there are only a small number of matrix operations that are supported for sparse matrices.

For smaller networks, you can use the SUB2NDX function (added in SAS/IML 12.1) to quickly build a (dense) adjacency matrix:

proc iml;

nodes = {

3 1,

4 2,

2 3 };

maxNode = max(nodes);

adj = j(maxNode, maxNode, 0);

idx = sub2ndx(dimension(adj), nodes);

adj[idx] = 1;

print adj;

View solution in original post

8 REPLIES 8
Rick_SAS
SAS Super FREQ

SAS has a product (SAS Social Network Analysis) for SNA, but it doesn't use SAS/IML.

What you intend to do with the adjacency matrix once you have it?  For a matrix that large, the obvious approch is to use a sparse representation, but there are only a small number of matrix operations that are supported for sparse matrices.

For smaller networks, you can use the SUB2NDX function (added in SAS/IML 12.1) to quickly build a (dense) adjacency matrix:

proc iml;

nodes = {

3 1,

4 2,

2 3 };

maxNode = max(nodes);

adj = j(maxNode, maxNode, 0);

idx = sub2ndx(dimension(adj), nodes);

adj[idx] = 1;

print adj;

onesasuser
Calcite | Level 5

Thanks for your reply.

I am planning to use the matrix to calculate descriptors such as betweenness, eigenvector, average path length... Because the network is very large and operations on an edge list usually take a very long time, so I was trying to convert it to an adjacency matrix.

About SAS social network analysis, is there a trial version available on SAS website? I looked at the link you mentioned but seems only an introduction about this product is there.

Rick_SAS
SAS Super FREQ

Right.  Thought so.  I don't think IML will be able to handle yourfull  200,000x200,000 adjacency matrix.  For smaller networks, people have done what you are describing.  There were some interesting papers on this at SAS Global Forum and other conferences in the 2012-2013. Do an internet search for

     iml airport connectivity centrality

and you'll find some papers by Hector Rodriguez-Deniz that you might find interesting.

onesasuser
Calcite | Level 5

Ok, I see.

Thank you for the suggestions, though the examples you mentioned used smaller networks, they are very useful. Thank you.

Matthew_Galati
SAS Employee

Hi. What you want to use is PROC OPTGRAPH - this procedure can calculate all of these decsriptors, uses sparse representations, and scales very well. In order to use PROC OPTGRAPH, you nee da SAS Social Network Analysis (SNA) server license.

There is no trial version of SAS Social Network Analysis server that I am aware of.

To learn more about what PROC OPTGRAPH offers, you can consult the documentation here:

http://support.sas.com/documentation/solutions/optgraph/index.html

onesasuser
Calcite | Level 5

Hello, thanks for your reply.

Indeed the functions in PROC OPTGRAPH are what I'm looking for. But I guess SNA is only for business use? Because I'm a student so I wonder if it is possible for a student to obtain a server license?

Matthew_Galati
SAS Employee

Unfortunately, I do not think there are any student licenses for PROC OPTGRAPH.

onesasuser
Calcite | Level 5

Ow ok, thanks anyway.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 8 replies
  • 6296 views
  • 6 likes
  • 3 in conversation