Boxchart for Experimental Data

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: QCAD1                                               */
 /*   TITLE: Boxchart for Experimental Data                      */
 /* PRODUCT: QC                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: Shewhart Charts,                                    */
 /*   PROCS: SHEWHART                                            */
 /*    DATA:                                                     */
 /*    MISC: This is the first of 3 examples showing different   */
 /*          phases in the evolution of a process: 1) analysis   */
 /*          of experimental results; 2) comparison of control   */
 /*          charts for the process before and after design      */
 /*          changes; 3) analysis of the capability of the       */
 /*          improved process. See also QCAD2 and QCAD3.         */
 /*                                                              */
 /*          If you are using a monochrome graphics device,      */
 /*          eliminate the CBOXFILL and CBLOCKVAR options.       */
 /*                                                              */
 /****************************************************************/

data trial;
  input sample s1-s20;
  array s{20};
  length cgrpa $8;
  label grpc='Temperature';
  if sample > 1 then id = 'Malfunction';
  /*---------------------------------------*/
  /* block labels and colors defined below */
  /*---------------------------------------*/
  select(sample);
     when(1) do;
        grpa  = 'Method A';
        grpb  = 'Blend 1';
        grpc  = 'High';
        cgrpa = 'blue';
        end;
     when(2) do;
        grpa  = 'Method A';
        grpb  = 'Blend 1';
        grpc  = 'Low';
        cgrpa = 'blue';
        end;
     when(3) do;
        grpa  = 'Method B';
        grpb  = 'Blend 1';
        grpc  = 'High';
        cgrpa = 'green';
        end;
     when(4) do;
        strength = exp( .4 * rannor(12345) + .1) +.28;
        grpa  = 'Method B';
        grpb  = 'Blend 1';
        grpc  = 'Low';
        cgrpa = 'green';
        end;
     when(5) do;
        grpa  = 'Method A';
        grpb  = 'Blend 2';
        grpc  = 'High';
        cgrpa = 'blue';
        end;
     when(6) do;
        grpa  = 'Method A';
        grpb  = 'Blend 2';
        grpc  = 'Low';
        cgrpa = 'blue';
        end;
      when(7) do;
        grpa  = 'Method B';
        grpb  = 'Blend 2';
        grpc  = 'High';
        cgrpa = 'green';
        end;
      when(8) do;
        grpa  = 'Method B';
        grpb  = 'Blend 2';
        grpc  = 'Low';
        cgrpa = 'green';
        end;
     otherwise;
     end;
  do i=1 to 20;
     strength=s{i};
     output;
     end;
  cards;
1  1.6736260254 1.6026390189 1.4407135356 1.4632449811 1.8317908760
2.5930494368 0.6793996573 3.3361377057 2.7585319540 1.9863320205
0.7033009803 2.4851456468 1.0933763373 7.6383346107 1.7725021334
3.8855153458 2.8366437166 2.2038857191 3.5194147337 3.1554696013
2  1.6025430490 2.3255181473 0.6783267828 2.0761584599 5.0300570331
7.1280861212 0.6407723411 0.5167304492 0.5625683726 0.6472189671
1.8683560079 0.6462213180 2.1038253882 1.3478208237 0.9849618229
0.7940371223 0.7866301313 0.9426266868 0.9389159335 0.9214806598
3  1.2712835521 2.0807726178 1.3693355584 2.9560799102 1.9654892053
1.1413007662 1.5489247268 3.4389602847 1.8993874255 1.1183584632
1.0666896373 2.1031163583 1.4939419181 0.8903380799 1.9053531859
1.8384130000 1.2735845865 1.2211816245 1.6321004021 2.7615452076
4  1.2920042809 1.5754580559 2.1414542092 1.8038266675 1.0679030227
1.4974859671 1.9560580062 1.0833843007 2.3234624163 1.1671957852
1.3540727089 1.1946191385 1.3492617458 1.9656449320 1.5407767241
1.7408823485 0.8275521072 1.0495696353 1.7653595974 1.4156226855
5  2.7773892134 2.4469720175 5.0317465480 3.3841862908 2.5335500439
1.5355854728 1.9762685585 2.8186648339 5.2286553617 6.9553612422
5.1766902598 3.9412558280 1.8300343778 4.3360693237 3.0466078721
3.3095744368 6.7020502747 2.7901736840 12.647997763 9.1279698386
6  3.6700862601 2.2877673799 1.9902334333 2.1238802877 4.0106736616
12.819710893 5.2508880591 1.9429965804 1.8389324359 5.8900202815
1.3075030281 1.3139301545 1.7779804965 1.7171530387 1.8847335538
4.3570369614 3.9800858645 8.2482981424 3.3412096295 3.3017813934
7  3.2087586922 5.1060679707 4.6677958846 3.5319394403 4.2952164947
4.2562602682 3.3802358753 5.2697008001 3.8788187888 2.6177415718
3.0748920661 2.8396653242 2.8857301872 2.3082093056 3.7418795958
3.4136741330 3.6158372888 3.9009295558 4.7821943112 5.1330197324
8  5.4777365577 4.4749706246 4.1049932487 5.6844477944 4.4153528289
4.4287902264 4.8813419024 3.9036096383 3.5166852584 3.4824804541
3.1129729729 2.5791559130 3.0493113760 5.3113361482 3.8823626758
5.0837977561 4.8480863996 6.2367014724 3.0107675826 3.5908343619
;

symbol1 v=C c=yellow  h=1 f=marker;
symbol2 v=D c=yellow  h=1 f=marker;

proc shewhart data=trial;
   id id;
   legend1 cframe=gray cborder=black;
   boxchart strength * sample (grpa grpb)=grpc
            /nolimits
             cblockvar    = ( cgrpa )
             nolegend
             blockpos     = 2
             symbollegend = legend1
             idsymbol     = dot
             cboxes       = white
             cframe       = gray
             cboxfill     = ( cgrpa )
             serifs
             boxstyle     = schematicidfar
             novangle
             ;
   label sample   = 'Batch'
         strength = 'Fiber Strength';
   title 'Experimental Results';
run;

goptions reset=all;