GKPI Procedure

Example 6: Creating a Traffic Light

Features:

PROC GKPI statement option: MODE=RAISED

TRAFFICLIGHT statement options:
COLORS=
LABEL=
NOAVALUE
Sample library member: GKPTRAFF
This example creates a traffic light that uses primary green, yellow, and red colors. Colors are applied to vertical KPI charts from the bottom up, so to get red at the top, you must specify red last in the list of colors.
traffic light with red at the top

Program

goptions reset=all device=javaimg xpixels=120 ypixels=210;
proc gkpi mode=raised;
   trafficlight actual=598 bounds=(1500 900 600 0) /
   colors=(green yellow red)  noavalue
   label="New Subscriptions";
run;
quit;

Program Description

Set the graphics environment.The XPIXELS and YPIXELS graphics options reduce the size of the graphics output area and, therefore, reduce both the size of the KPI chart and the distance between the label and the KPI chart. These options statement to scale the KPI charts to a size that would be appropriate for use in a dashboard.
goptions reset=all device=javaimg xpixels=120 ypixels=210;
Generate the KPI chart. Specify the range boundaries, actual KPI value, and colors. The NOAVALUE option turns off the display of the actual KPI value. The colors are specified as SAS Registry Color names.
proc gkpi mode=raised;
   trafficlight actual=598 bounds=(1500 900 600 0) /
   colors=(green yellow red)  noavalue
   label="New Subscriptions";
run;
End the procedure. The GKPI procedure supports RUN-group processing, so it is recommended that you enter the QUIT statement to end the procedure.
quit;