I'm approaching my retirement, so learning about SAS Visual Analytics is not high on my To Do list. However, I recently discovered a sparsely documented graphics feature in the Data Step that I thought had been removed decades ago.
DSGI (Data Step Graphics Interface) used to be THE way to create free-form plots, so, when I discovered it was still there in SAS 9.4M8, I had to include this program in my new book:
/* set the graphics environment */
GOPTIONS RESET = GLOBAL GUNIT = PCT BORDER
HSIZE = 18 CM VSIZE = 12 CM
DEVICE = PNG;
/* execute a DATA step with DSGI */
DATA heart;
/* initialize SAS/GRAPH software to accept DSGI statements */
rc = GINIT();
rc = GRAPH("CLEAR");
/* assign colours to colour index */
rc = GSET("COLREP", 1, "BLUE");
rc = GSET("COLREP", 2, "RED");
/* define and display titles */
rc = GSET("TEXCOLOR", 1);
rc = GSET("TEXFONT", "SWISSB");
rc = GSET("TEXHEIGHT", 6);
rc = GDRAW("TEXT", 90, 83, "Heart");
/* change the height and display second title */
rc = GSET("TEXHEIGHT", 4);
rc = GDRAW("TEXT", 90, 75, "Created with DSGI");
/* change the height and display footnote */
rc = GSET("TEXHEIGHT", 4);
rc = GDRAW("TEXT", 130, 15, "SAS");
/* define and draw heart */
rc = GSET("LINCOLOR", 2);
rc = GSET("LINWIDTH", 1);
pi = CONSTANT('PI');
centerx = 110;
centery = 40;
scalex = 30 / 16;
scaley = 30 / 18;
DO t = 0 TO (2 * pi) BY 0.01;
x = centerx + scalex * (16 * SIN(t) ** 3);
y = centery + scaley * (13 * COS(t) - 5 * COS(2 * t)
- 2 * COS(3 * t) - COS(4 * t));
IF t > 0 THEN rc = GDRAW("LINE", 2, x0, x, y0, y);
OUTPUT;
x0 = x;
y0 = y;
END;
/* display graph and end DSGI */
rc = GRAPH("UPDATE");
rc = GTERM();
RUN;
The SAS Log states that DSGI will no longer be supported from SAS 9.3!
I will be posting more about my new book “Memoirs of a Power SAS User” after it has been published. In the meanwhile you can see more of my books on Amazon and Lulu.com (https://www.lulu.com/spotlight/hollandnumerics).