Previous Page | Next Page

The GKPI Procedure

Concepts


Specifying Basic or Raised Mode

Each KPI chart can be displayed in basic mode, which appears flat and two-dimensional, or in raised mode, which appears raised and three-dimensional. The default mode is basic mode. You can specify a mode on the PROC GKPI statement:

proc gkpi mode=raised;

The following figures illustrate the difference in appearance between basic mode and raised mode for each type of KPI chart.

Horizontal Slider in Basic and Raised Modes

[sliders in basic and raised modes]

Bullet graphs appear similar to sliders.

Dial in Basic and Raised Modes

[dials in basic and raised modes]

Speedometer in Basic and Raised Modes

[speedometer in basic and raised modes]

Traffic Light in Basic and Raised Modes

[Traffic light in basic and raised modes]


Specifying Segment Boundaries and Actual KPI Values

To generate a KPI chart, you must specify a list of segment boundaries using the BOUNDS= option and an actual KPI value using the ACTUAL= option. The values can be positive numbers, negative numbers, or missing (ACTUAL=.), but the BOUNDS= list must be in either ascending or descending order and must contain at least two numbers (in order to define a single segment). For example, the following code defines a horizontal slider with segment boundaries in ascending order from -8 to 10 and an actual KPI value of 6:

goptions device=javaimg;
ods html;
proc gkpi;
   hslider actual=6 bounds=(-8 -5 0 3 5 10);
run;
quit;
ods html close;

[Slider showing boundary values from negative 8 to positive 10]

The boundaries can also be specified in desending order, for example:
hslider actual=6 bounds=(10 5 3 0 -5 -8)

[Slider showing boundary values from positive 10 to negative 8]

The order in which colors are applied is not affected by whether boundaries are specified in ascending or descending order. See Defining Active and Inactive Color Lists for information on controlling segment colors.

The actual KPI value can fall outside of the highest or lowest boundaries, but the GKPI procedure treats such values as if they occur at the edge of the highest or lowest boundaries. For example, suppose the actual KPI value is -10, but the lowest boundary value is -8:

hslider actual=-10 bounds=(-8 -5 0 3 5 10)

PROC GKPI displays the actual KPI value indicator at -8.

[Slider showing actual KPI indicator at negative 8]

If you specify a missing value for the actual KPI value (ACTUAL=.), then the GKPI procedure does not generate a KPI chart.


Controlling the Display of Boundary and Tick Mark Values

In some cases, there might not be enough space to display all of the boundary values or, for speedometers, tick mark values without some of the values colliding together. In these cases, the GKPI procedure typically drops some or all of the boundary or tick mark values, depending on the amount of space available, the font size being used, and the values that need to be displayed.

If the GKPI procedure drops values, you can try the following solutions:

See Creating a Dial KPI Chart for an example that uses the XPIXELS=, YPIXELS=, BFONT=, and FORMAT= options.

Controlling Segment Colors


Default Colors

If you define only one segment or more than five segments, the GKPI procedure uses the same value of gray (hexadecimal RGB value B2B2B2) for all segments.

GKPI Procedure Gray Scale Default

[GKPI Procedure Grayscale Default]

If you define two to five segments, the GKPI procedure uses some or all of the colors shown in GKPI Procedure Default Colors as the default colors.

GKPI Procedure Default Colors

[GKPI Procedure Default Colors]

For example, if you define only three segments, the GKPI procedures uses the red, yellow, and green colors shown in GKPI Procedure Default Colors.

[Silder with three segments using default red, yellow, and green colors.]

Hexadecimal Values for GKPI Procedure Default Colors lists the hexadecimal values for each of these default colors.

Hexadecimal Values for GKPI Procedure Default Colors
Color Hexadecimal
RGB Value
Red cxD06959
Orange cxE1A05D
Yellow cxF1DC63
Yellow-Green cxBDCD5F
Green cx84AF5B

The traffic light also uses the default colors, but it applies them slightly differently. If you define only one segment, then the procedure displays the light for that segment in gray. If you define two to five segments, the traffic light uses the default color listed in Hexadecimal Values for GKPI Procedure Default Colors only for the light corresponding to the segment that contains the actual KPI value. All other lights are gray. If you define more than five segments, all lights are displayed in gray, but the light corresponding to the segment that contains the actual KPI value is displayed in dark gray. In other words, only one light in a traffic light is "turned on" at a time. All other lights are "turned off."

Traffic Light Default Colors

[Two traffic lights using the default colors]

Colors are applied in the same direction, regardless of whether the segment boundaries are in ascending or descending order. Colors for horizontal sliders and bullet graphs are applied from left to right. Colors for traffic lights, vertical sliders, and vertical bullet graphs are applied from bottom to top. Colors for dials and speedometers are applied clockwise.

[Two dials with boundary values reversed on the second dial. Colors are applied in the same order on both dials.]


Defining Active and Inactive Color Lists

You can define two different color lists: a list of active colors and a list of inactive colors. The active color list is defined with the ACTIVECOLORS= option, and the inactive color list is defined with the COLORS= option. Neither option is required.

Each color in a list corresponds to a segment in the KPI chart. That is, the first color is applied to the first segment, the second color is applied only to the second segment, and so on. A segment is displayed in its active color if the actual KPI value falls in that segment. All segments that do not contain the actual KPI value are displayed in their inactive colors. If you do not specify an active color list, then the segment that contains the actual KPI value is also displayed in its inactive color.

Note:   The TRAFFICLIGHT statement supports both the COLORS= option and the ACTIVECOLORS= option. However, if both options are specified, the COLORS= option is ignored. All segments that do not contain the actual KPI value appear gray.  [cautionend]

You can specify colors for the segments using any of the color-naming schemes supported by SAS/GRAPH. See Specifying Color Names.

If you specify the COLORS= option, then you must specify a color for each segment. That is, the number of entries in the COLORS= list must be one less than the number of entries in the BOUNDS= list. If you specify the ACTIVECOLORS= list, you do not have to specify a color for every segment. See Specifying Active Colors Only for Specific Segments (Using Null Colors) for more information.


Example: Specifying an Inactive Color List

The following example uses color names defined in the SAS registry to specify the inactive color list. The GKPI procedure uses these colors instead of the default colors shown in GKPI Procedure Default Colors.

goptions reset=all device=javaimg;
ods html;
proc gkpi mode=raised;
   hslider actual=0.28
   bounds=(0 .22 .35 .50) /
   colors=(PaleTurquoise MediumTurquoise Teal);
   run;
quit;
ods html close;

[Slider showing three segments in colors pale turquoise, medium turquoise, and teal.]

The actual KPI value falls into the second segment, and there are no active colors specified, so the second color in the COLORS= list, MediumTurquoise, is used for the second segment and for the actual KPI value indicator.

Example: Specifying an Active Color List

The following example defines the inactive colors for all of the segments to be the same value of gray, cxB2B2B2. For the active colors, it specifies the default values for the red, yellow, and green colors listed in Hexadecimal Values for GKPI Procedure Default Colors.

goptions reset=all device=javaimg;
ods html;
proc gkpi mode=raised;
   hslider actual=0.28
   bounds=(0 .22 .35 .50) /
   colors=(cxB2B2B2 cxB2B2B2 cxB2B2B2)
   activecolors=(cxD06959 cxF1DC63 cx84AF5B);
run;
quit;
ods html close;

The actual KPI value is 0.28, which falls into the second segment, so the second color listed in the ACTIVECOLORS= color list, cxF1DC63, which is yellow, is used as the color for the second segment instead of gray.

[Slider showing three segments. Second segment is yellow.]

If the actual KPI value is changed to 0.43, then the third color in the ACTIVECOLORS= color list, cx84AF5B, which is green, is used for the third segment instead of gray.

[slider with three segments. Third segment is green.]


Specifying Active Colors Only for Specific Segments (Using Null Colors)

If you specify a null color for a segment in the ACTIVECOLORS= list, then either the default color or the color in the COLORS= list, if one is specified, is used for that segment even if it contains the actual KPI value.

To specify a null color, you can specify null for the color or enter a comma-delimited list with no space between the commas. For example, if you have five segments and you want red to be used only for the lowest and highest segments, then you can specify the ACTIVECOLORS= list in either of the following forms:

activecolors=(red,null,null,null,red)
activecolors=(red,,,,red)

The default colors (or the color in the COLORS= list) will be used for segments two through four even if the actual KPI value falls into one of these segments.

The ACTIVECOLORS= list does not have to specify a color for each segment, but the one-to-one correspondence between the colors that are specified and the segments is maintained. For example, supposed you define five segments and you specify the following:

activecolors=(red green)

The GKPI procedure treats this specification as if you had entered the following:

activecolors=(red,green,null,null,null)

Red applies only to the first segment, and green applies only to the second segment. Default colors (or COLORS= colors) apply to all the other segments.


Specifying Color Names

You can specify colors for the segments using any of the color-naming schemes supported by SAS/GRAPH. For a complete description of these color-naming schemes, see Color-Naming Schemes. The following table shows examples of each of the color naming schemes:

Examples of Specifying Colors
Color-Naming Scheme Example
RGB
COLORS=(cx98FB98 cxDDA0DD cxFFDAB9 cxDB7093 cxB0E0E6)
CMYK
COLORS=("FF00FF00" "00FFFF00" "FFFFFF00")
HLS
COLORS=(H14055FF H0F060FF H0B485FF H07880FF)
HSV
COLORS=(V0F055FF v010FFFF v03BFFFF v12C55E8)
Gray Scale
COLORS=(GRAY4F GRAY6D GRAY8A GRAYC3)
SAS Registry Colors
COLORS=(palegreen plum peachpuff palevioletred powderblue)
CNS Color Names
COLORS=("very light purplish blue" 
"light vivid green" "medium strong yellow" 
"dark grayish green")


Specifying Fonts

You can control the fonts that are used to display the boundary and tick mark values, the actual KPI values, and the labels with the BFONT=, AFONT=, and LFONT= options, respectively. Each of these options takes a font specification of the following form:

<FONT="fontname</BOLD></ITALICS>"> <COLOR=color> <HEIGHT=text-height<units>>

FONT= "fontname</BOLD></ITALICS>"

specifies the font name. You can specify only system fonts (such as TrueType and UNIX system fonts), not SAS/GRAPH fonts. See Specifying Fonts in SAS/GRAPH Programs for more information.

Alias: F=
COLOR=color

specifies the text color. You can specify the color in any of the color-naming schemes recognized by SAS/GRAPH.

See Specifying Color Names for more information.

Alias: C=
HEIGHT= text-height<units>

specifies the font height in units. You can specify the text height in units of points (PT), centimeters (CM), inches (IN), or percentage of the graphics output area (PCT). The default unit is PCT.

Alias: H=

The LFONT= option also enables you to specify the JUSTIFICATION= option:

<FONT="fontname</BOLD></ITALICS>"> <COLOR=color> <HEIGHT=text-height<units>>
<JUSTIFICATION=LEFT|CENTER|RIGHT>

JUSTIFICATION=

specifies whether the text is left-justified, centered, or right-justified within the graphics output area. You can specify LEFT, RIGHT, or CENTER. The default is CENTER.

Alias: J=

Previous Page | Next Page | Top of Page