BookmarkSubscribeRSS Feed
xtc283x
Quartz | Level 8

There are many papers on using SAS/Graph to visualize networks of predator-prey food networks. I have a much more specific graph I would like to do in SAS that is summarized in this Science article titled "Asymmetric Coevolutionary Networks." The graph captured in this article has the network laid out in vertical arrays with lines drawn between the nodes to indicate the degree of association. How would I express such a visual relationship in SAS?

Thank you.

http://www.sciencemag.org/content/312/5772/431/F1.expansion.html

6 REPLIES 6
ballardw
Super User

Look to see if you have access to the SAS/Grahp Network Visualization Workshop.

I believe you would be looking at a variation on the Fixed Position Network Graph where your Positions file would have on value of x-axis and varying y-axis for each node descriptor.

xtc283x
Quartz | Level 8

Thank you. I do not have this Workshop in my SAS installation. Any other suggestions?

Jay54
Meteorite | Level 14

Simple network diagrams could be created using SGPLOT or GTL, as long as you can position the nodes.

I described one case here:  http://blogs.sas.com/content/graphicallyspeaking/2014/09/21/splines/

In your case the nodes are in a simple two column arrangement.  In such cases,you could use a Vector plot to draw the links, and overlay that with a Bubble plot to draw the nodes with or without labels.  You can suppress the axes and other outlines.

I will write up a simple case.  What release of SAS (including maintenance level) do you have?

xtc283x
Quartz | Level 8

That would be so helpful! Especially if I can get it to work on my data. Btw, I want to create a network for over 200 medical diagnostic codes to graphically illustrate their co-occurrence in patients over a year's period.

I'm running v9.3 with the TSIM1 maintenance install.

Thank you.

Jay54
Meteorite | Level 14

Here is a simple example.  The NOBORDER option may not work on SAS 9.3, you can remove it.

To keep it simple, I just hard coded the link coordinates.  However, a better way is to provide the FromNodeId and ToNodeId for the links, create Hash Object for Nodes and extract the link end coordinates from the hash object using the nodeids.  Sorry, I could not attach the resulting image.

Clearly, it does not do the nice layout of the nodes for uslike a Network Diagram statement would, but we are really using the graph code meant for something else to draw diagrams for us.

data diagram;

  input nodeid grp nx ny linkid x1 y1 x2 y2;

  size=10;

  datalines;

1  1  10  10  1  10  10  20   8

2  1  10   8  2  10  10  20   6

3  1  10   6  3  10  6   20  10

4  2  20  10  .  .   .   .    .

5  2  20   8  .  .   .   .    .

6  2  20   6  .  .   .   .    .

;

run;

title 'Network Diagram';

proc sgplot data=diagram noautolegend noborder;

  vector x=x2 y=y2 / xorigin=x1 yorigin=y1;

  bubble x=nx y=ny size=size / group=grp bradiusmin=15 bradiusmax=20;

  xaxis display=none offsetmin=0.2 offsetmax=0.2;

  yaxis display=none offsetmin=0.2 offsetmax=0.2;

run;

xtc283x
Quartz | Level 8

Thank you! That worked despite a Java issue.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1217 views
  • 6 likes
  • 3 in conversation