Creating Constellation Diagrams

About the Constellation Applet

The Constellation Applet provides interactivity for node and link diagrams that illustrate data that is associative or requires an arc list. Node and link color and size can be associated with specified data values.
A Constellation Diagram
A Constellation Applet Affinity Diagram
Interactive features of the Constellation Applet include pop-up data tips for links and nodes, subsetting of links via an embedded scroll bar, pan and zoom, and several node and link selection modes. You can define drill-down URLs for nodes, specify menu text for the drill-down action, insert a background image, and specify a drill-down URL for the background image, among other enhancements. You can also specify your own JavaScript methods to define responses to drill-down actions.
The Constellation Applet, like the Treeview applet, differs from the other applets in that the diagrams that they display are not generated by SAS/GRAPH procedures. The DS2CONST macro generates and formats an HTML output file, and specifies the appearance and behavior of the node and link diagram based on values in a data set.

When to Use the Constellation Applet

The Constellation Applet is best used to illustrate relationships between links and nodes, which can be shown in affinity, sequence, and Web-click path diagrams, for example. Colors, link line widths, and link directional indicators can be specified to illustrate relationships. Pop-up data tips can be specified for nodes and links, along with drill-down URLs for nodes and for an optional background image. For diagrams that illustrate associative data, an embedded scroll bar subsets the data in the diagram dynamically.
The Constellation Applet cannot be used to display hierarchical data. To create hierarchical diagrams such as organizational trees, use the TreeView Applet. For information about the Treeview Applet, see Creating Treeview Diagrams.

Programming with the DS2CONST Macro for the Constellation Applet

The DS2CONST macro enables you to generate complete Web presentations for the Constellation Applet. The macro has a large number of arguments that you can use to generate and format an HTML output file, configure the diagram, and describe how data sets and variables are to be applied to the diagram.
The macro arguments are structured so that you can associate a variable with an aspect of the diagram. The values of the variable are then used for that part of the diagram. For example, the NLABEL argument specifies the name of the variable whose values define the text labels that are to be applied to the nodes. Other arguments provide default values that are used when no variable value is provided.
Descriptions of all of the arguments of the DS2CONST macro are provided in DS2CONST Macro Arguments.
Run the following code to use the DS2CONST macro to generate the Web presentation for the Constellation Applet shown in the picture above. (Note that the ODS LISTING destination must be open when you run the DS2CONST macro.)
/* Define the path to the archive file, the HTML output file, and the SAS
library */
%let jarfiles = path-to-archive-files;
%let htmlfile = html-filename.htm;
%let lib      = WORK; /* put everything in the WORK library */

/* Define the node names and locations. */
data &lib..regions;
length regionName $80            /* Node text label */
       regionId $4               /* Node identifying string */
       xLoc yLoc 8;              /* Pixel position of node */
input regionID xLoc yLoc reserve RegionName $ &;
cards;
PNW 30 30 8.5 Western Systems Coordinating Council - Pacific Northwest
NWPE 100 60 8.5 Western Systems Coordinating Council - Northwest Power Pool East
CALI 40 220 9.5 Western Systems Coordinating Council - California
RMPA 140 180 10.8 Western Systems Coordinating Council - Rocky Mountain Power Area
AZNM 110 310 12.9 Western Systems Coordinating Council - AZNMSNV
MAPP 180 80 15 Mid-continent Area Power Pool
SPPN 185 200 13.6 Southwest Power Pool - North
SPPS 170 270 13.6 Southwest Power Pool - South
ERCT 180 400 15 Electric Reliability Council of Texas
WUMS 270 90 17 Wisconsin - Upper Michigan
MANO 290 240 17 Mid-America Interconnected Network - South
ENTG 290 360 12.4 Entergy
MECS 350 130 15 Michigan Electric Coordination System
ECAO 360 200 15 East Central Area Reliability Coordination Agreement - South
TVA 360 300 12.4 Tennessee Valley Authority
SOU 390 400 12.4 Southern Company
FRCC 420 460 15 Florida Reliability Coordinating Council
VACA 450 340 12.4 Virginia and Carolinas
MACS 460 280 19 Mid-Atlantic Area Council - South
MACE 495 235 19 Mid-Atlantic Area Council - East
MACW 430 220 19 Mid-Atlantic Area Council - West
UPNY 450 160 18 Upstate New York
DSNY 500 170 18 Downstate New York
NYC 530 200 18 New York City
LILC 570 170 18 Long Island Lighting Company
NENG 570 90 18 New England Power Pool
;
run;

/* Define the node connections. */
data &lib..links;
length from to $4 ltip $12 lcolor $8;
format capacity comma.;
input  from to capacity;
lcolor = "#BBBBBB"; /* Light gray lines */
ltip = left(put(capacity, comma.) || " MW"); /* Define the tool tips */
if      capacity <  500 then width = 1; /* Define the line widths */
else if capacity < 1000 then width = 2;
else if capacity < 2000 then width = 3;
else if capacity < 3000 then width = 4;
else                         width = 5;
cards;
MECS ECAO 2250
ECAO MECS 2250
ECAO MACW 2957
ECAO MANO 1655
ECAO TVA 1890
ECAO VACA 2334
ERCT SPPS 635
MACE MACW 1500
MACE DSNY 1130
MACS MACW 1800
MACS VACA 3075
MACW ECAO 2612
MACW MACE 3368
MACW MACS 3075
MACW UPNY 481
MANO ECAO 3033
MANO WUMS 608
MANO MAPP 531
MANO SPPN 1191
MANO TVA 2207
MANO ENTG 1245
WUMS MANO 1080
WUMS MAPP 676
MAPP MANO 1150
MAPP WUMS 324
MAPP SPPN 1172
MAPP ENTG 1000
MAPP NWPE 150
MAPP RMPA 233
NENG DSNY 1425
UPNY MACW 1418
UPNY DSNY 3750
DSNY LILC 788
DSNY MACE 308
DSNY NENG 1125
DSNY UPNY 3750
DSNY NYC 3750
NYC LILC 788
NYC DSNY 3750
LILC DSNY 938
LILC NYC 788
SPPN MANO 1228
SPPN MAPP 891
SPPN SPPS 525
SPPN ENTG 636
SPPS ERCT 569
SPPS ENTG 636
SPPS SPPN 900
SPPS AZNM 315
SPPS ENTG 1200
ENTG SOU 1136
ENTG TVA 1278
ENTG MANO 1399
ENTG SPPS 292
ENTG SPPN 292
ENTG MAPP 856
SOU FRCC 4516
SOU TVA 1810
SOU VACA 1346
SOU ENTG 1902
FRCC SOU 21
TVA ECAO 2235
TVA MANO 2331
TVA SOU 2052
TVA ENTG 2153
TVA VACA 2261
VACA ECAO 2822
VACA MACS 2794
VACA SOU 3042
VACA TVA 2240
CALI PNW 4922
CALI AZNM 0
CALI NWPE 1184
PNW CALI 5903
PNW NWPE 1050
RMPA MAPP 233
RMPA AZNM 518
RMPA NWPE 413
NWPE RMPA 413
NWPE CALI 1574
NWPE MAPP 113
NWPE AZNM 840
NWPE PNW 2145
AZNM CALI 5663
AZNM NWPE 638
AZNM RMPA 518
AZNM SPPS 315
;
run;

/* Close the ODS HTML destination and open the ODS LISTING destination. */
ods html close;
ods listing;

/* Set chart title.  */
title1 "Electric Power Regional Interconnections";
title2 "Created with SAS/GRAPH Constellation Applet";
footnote1 "Link: Base Electricity Transfer Capacity";
footnote2 "Node: Generation Reserve Margin";

/* Use the DS2CONST macro to generate the chart. */
%ds2const(/* Arguments for the Applet Tag */
      codebase=&jarfiles,   /* Path to archive file */
      height=520,           /* Applet window height */
      width=600,            /* Applet window width */

      /* Arguments for Data Definition */
      datatype=assoc,       /* Size nodes by nvalue var  */
      nsize=reserve,        /* Node sizes */
      ncolval=reserve,      /* Node colors */
      layout=user,          /* Use nx/ny to position nodes */
      nx=xLoc,              /* x-coordinate of node */
      ny=yLoc,              /* y-coordinate of node */
      lcolor=lcolor,        /* Link color */
      lvalue=width,         /* Link values */
      lwidth=width,         /* Link widths */
      minlnkwt=0,           /* Sets minimum link weight displayed*/
      labels=y,             /* Display node labels */
      linktype=line,        /* Do not show flow direction */
      ndata=&lib..regions,  /* Node data */
      ldata=&lib..links,    /* Node linkage data */
      nid=regionID,         /* Var for node ID string */
      nlabel=regionID,      /* Var for node label string */
      lfrom=from,           /* Var for from-node ID */
      lto=to,               /* Var for to-node ID */
      ntip=RegionName,      /* Var for popup node text */
      ltip=ltip,            /* Var for popup line text */

      /* Arguments for Generating HTML and XML Files */
      htmlfile=&htmlfile,   /* Output file name */
      openmode=replace,     /* Create a new html file */

      /* Arguments for Diagram Appearance */
      nodeshap=circle,      /* Node shape */
      border=y,             /* Enclose diagram */
      colormap=y,           /* Use colormap for link/node colors */
      fntsize=14,           /* Node label font size */
      fntstyl=plain,        /* Node label font style */

      /* Arguments for Page Formatting */
      bgtype=color,         /* Use page background color */
      bg=#DDDDDD,           /* The page background color */
      center=y,             /* Center chart on the page */
      septype=none,         /* No separator line */

      /* Arguments for the SAS TITLE and FOOTNOTE Tags */
      tcolor=#0000FF,       /* Title text color */
      fcolor=#0000FF,       /* Footnote text color */
      tsize=3,              /* Title text size */
      fsize=2);             /* Footnote text size */

/* Close ODS LISTING and open ODS HTML. */
ods listing close;
ods html;
Display the resulting HTML file in a Web browser to run the applet and generate the diagram.
Arguments in the DS2CONST macro identify the name of the nodes and links data sets. In the nodes data set, arguments identify a node ID variable and a node label variable. Other arguments identify the links data set and the variables that define the nodes at the start and end of each link line.
For information about more complex presentations for the Constellation Applet, see Enhancing Presentations for the Constellation Applet.