Highlighting Tiles in a Comparative Pareto Chart

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: PAREX5                                              */
/*   TITLE: Highlighting Tiles in a Comparative Pareto Chart    */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Pareto Charts                                       */
/*   PROCS: PARETO                                              */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT: saswgr                                              */
/*     REF: PROC PARETO, Example 5                              */
/*    MISC:                                                     */
/*                                                              */
/****************************************************************/

data Failure4;
   length Process $ 9 Cause $ 16;
   label  Cause   = 'Cause of Failure';
   input  Process & $ Day & $ Cause & $ Counts;
   datalines;
Process A   March 1   Contamination    15
Process A   March 1   Corrosion         2
Process A   March 1   Doping            1
Process A   March 1   Metallization     2
Process A   March 1   Miscellaneous     3
Process A   March 1   Oxide Defect      8
Process A   March 1   Silicon Defect    1
Process A   March 2   Contamination    16
Process A   March 2   Corrosion         3
Process A   March 2   Doping            1
Process A   March 2   Metallization     3
Process A   March 2   Miscellaneous     1
Process A   March 2   Oxide Defect      9
Process A   March 2   Silicon Defect    2
Process A   March 3   Contamination    20
Process A   March 3   Corrosion         1
Process A   March 3   Doping            1
Process A   March 3   Metallization     0
Process A   March 3   Miscellaneous     3
Process A   March 3   Oxide Defect      7
Process A   March 3   Silicon Defect    2
Process A   March 4   Contamination    12
Process A   March 4   Corrosion         1
Process A   March 4   Doping            1
Process A   March 4   Metallization     0
Process A   March 4   Miscellaneous     0
Process A   March 4   Oxide Defect     10
Process A   March 4   Silicon Defect    1
Process A   March 5   Contamination    23
Process A   March 5   Corrosion         1
Process A   March 5   Doping            1
Process A   March 5   Metallization     0
Process A   March 5   Miscellaneous     1
Process A   March 5   Oxide Defect      8
Process A   March 5   Silicon Defect    2
Process B   March 1   Contamination     8
Process B   March 1   Corrosion         2
Process B   March 1   Doping            1
Process B   March 1   Metallization     4
Process B   March 1   Miscellaneous     2
Process B   March 1   Oxide Defect     10
Process B   March 1   Silicon Defect    3
Process B   March 2   Contamination     9
Process B   March 2   Corrosion         0
Process B   March 2   Doping            1
Process B   March 2   Metallization     2
Process B   March 2   Miscellaneous     4
Process B   March 2   Oxide Defect      9
Process B   March 2   Silicon Defect    2
Process B   March 3   Contamination     4
Process B   March 3   Corrosion         1
Process B   March 3   Doping            1
Process B   March 3   Metallization     0
Process B   March 3   Miscellaneous     0
Process B   March 3   Oxide Defect     10
Process B   March 3   Silicon Defect    1
Process B   March 4   Contamination     2
Process B   March 4   Corrosion         2
Process B   March 4   Doping            1
Process B   March 4   Metallization     0
Process B   March 4   Miscellaneous     3
Process B   March 4   Oxide Defect      7
Process B   March 4   Silicon Defect    1
Process B   March 5   Contamination     1
Process B   March 5   Corrosion         3
Process B   March 5   Doping            1
Process B   March 5   Metallization     0
Process B   March 5   Miscellaneous     1
Process B   March 5   Oxide Defect      8
Process B   March 5   Silicon Defect    2
;

data Failure4;
   length Priority $ 16;
   set Failure4;
   if Cause = 'Contamination' or
      Cause = 'Metallization'
   then
      Priority = 'High';
   else
   if Cause = 'Oxide Defect'
   then
      Priority = 'Medium';
   else
      Priority = 'Low';
run;

data Failure4;
   length Tilecol $ 8 Tileleg $ 16;
   set Failure4;
   if (Process='Process B') and (Day='March 4' or Day='March 5')
   then do; Tilecol='ywh'; Tileleg = 'Improvement'; end;
   else do; Tilecol='ligr'; Tileleg = 'Status Quo'; end;
run;

ods graphics off;
title 'Where Did Improvement Occur?';
proc pareto data=Failure4;
   vbar Cause / class        = ( Process Day )
                freq         = Counts
                nrows        = 2
                ncols        = 5
                last         = 'Miscellaneous'
                scale        = count
                catleglabel  = 'Failure Causes:'
     /* options for highlighting bars: */
                bars         = ( Priority )
                barlegend    = ( Priority )
                barleglabel  = 'Priority:'
     /* options for highlighting tiles: */
                ctiles       = ( Tilecol )
                tilelegend   = ( Tileleg )
                tileleglabel = 'Condition:'
                intertile    = 1.0
                cframeside   = ligr
                cframetop    = ligr
                nocatlabel
                nocurve;
run;

data Failure4;
   length PriorityColor $ 8;
   set Failure4;
   if Priority = 'High'
   then
      PriorityColor = 'CXD05B5B';
   else
   if Priority = 'Medium'
   then
      PriorityColor = 'CX6F7EB3';
   else
      PriorityColor = 'CX66A5A0';
run;

title 'Where Did Improvement Occur?';
proc pareto data=Failure4;
   vbar Cause / class        = ( Process Day )
                freq         = Counts
                nrows        = 2
                ncols        = 5
                last         = 'Miscellaneous'
                scale        = count
                catleglabel  = 'Failure Causes:'
                cbars        = ( PriorityColor )
                barlegend    = ( Priority )
                barleglabel  = 'Priority:'
                ctiles       = ( Tilecol )
                tilelegend   = ( Tileleg )
                tileleglabel = 'Condition:'
                intertile    = 1.0
                cframeside   = ligr
                cframetop    = ligr
                nocatlabel
                nocurve;
run;