GKPI Procedure

Controlling Qualitative Range Colors

Default Colors

If you define only one range or more than five ranges, the GKPI procedure uses the same value of gray (hexadecimal RGB value B2B2B2) for all ranges.
GKPI Procedure Gray Scale Default
GKPI Procedure Gray Scale Default
If you define two to five ranges, 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 ranges, the GKPI procedures uses the red, yellow, and green colors shown in GKPI Procedure Default Colors.
Silder with three ranges 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 range, then the procedure displays the light for that range in gray. If you define two to five ranges, the traffic light uses the default color listed in Hexadecimal Values for GKPI Procedure Default Colors only for the light corresponding to the range that contains the actual KPI value. All other lights are gray. If you define more than five ranges, all lights are displayed in gray, but the light corresponding to the range 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 range 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 range in the KPI chart. That is, the first color is applied to the first range, the second color is applied only to the second range, and so on. A range is displayed in its active color if the actual KPI value falls in that range. All ranges 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 range 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 ranges that do not contain the actual KPI value appear gray.
You can specify colors for the ranges 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 range. 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 range. See Specifying Active Colors Only for Specific Ranges (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 ranges in colors pale turquoise, medium turquoise, and teal.
The actual KPI value falls into the second range, and there are no active colors specified, so the second color in the COLORS= list, MediumTurquoise, is used for the second range and for the actual KPI value indicator.

Example: Specifying an Active Color List

The following example defines the inactive colors for all of the ranges 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 range, so the second color listed in the ACTIVECOLORS= color list, cxF1DC63, which is yellow, is used as the color for the second range instead of gray.
Slider showing three ranges. Second range 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 range instead of gray.
slider with three ranges. Third range is green.

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

If you specify a null color for a range in the ACTIVECOLORS= list, then either the default color or the color in the COLORS= list, if one is specified, is used for that range 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 ranges and you want red to be used only for the lowest and highest ranges, 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) are used for ranges two through four even if the actual KPI value falls into one of these ranges.
The ACTIVECOLORS= list does not have to specify a color for each range, but the one-to-one correspondence between the colors that are specified and the ranges is maintained. For example, supposed you define five ranges 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 range, and green applies only to the second range. Default colors (or COLORS= colors) apply to all the other ranges.

Specifying Color Names

You can specify colors for the ranges using any of the color-naming schemes supported by SAS/GRAPH. For a complete description of these color-naming schemes, see Examples of Specifying Colors. 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)
RGBA1
COLORS=(a98FB9833 aDDA0DD66 aFFDAB999 aDB7093CC aB0E0E6FF)
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")
1RGBA color mode is not supported by Java devices. RGBA color mode is supported by ActiveX devices when the output is used in Microsoft applications.