Resources

Box Chart Examples

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWBOXA                                             */
/*   TITLE: Box Chart Examples                                  */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Shewhart Charts, Box Charts,                        */
/*   PROCS: SHEWHART                                            */
/*    DATA:                                                     */
/*                                                              */
/*     REF: SAS/QC Software:  Usage and Reference, Version 6,   */
/*          First Edition, Volume 1 and Volume 2                */
/*                                                              */
/****************************************************************/

data Turbine;
   informat Day date7.;
   format Day date5.;
   label KWatts='Average Power Output';
   input Day @;
   do i=1 to 10;
      input KWatts @;
      output;
   end;
   drop i;
   datalines;
04JUL94 3196 3507 4050 3215 3583 3617 3789 3180 3505 3454
04JUL94 3417 3199 3613 3384 3475 3316 3556 3607 3364 3721
05JUL94 3390 3562 3413 3193 3635 3179 3348 3199 3413 3562
05JUL94 3428 3320 3745 3426 3849 3256 3841 3575 3752 3347
06JUL94 3478 3465 3445 3383 3684 3304 3398 3578 3348 3369
06JUL94 3670 3614 3307 3595 3448 3304 3385 3499 3781 3711
07JUL94 3448 3045 3446 3620 3466 3533 3590 3070 3499 3457
07JUL94 3411 3350 3417 3629 3400 3381 3309 3608 3438 3567
08JUL94 3568 2968 3514 3465 3175 3358 3460 3851 3845 2983
08JUL94 3410 3274 3590 3527 3509 3284 3457 3729 3916 3633
09JUL94 3153 3408 3741 3203 3047 3580 3571 3579 3602 3335
09JUL94 3494 3662 3586 3628 3881 3443 3456 3593 3827 3573
10JUL94 3594 3711 3369 3341 3611 3496 3554 3400 3295 3002
10JUL94 3495 3368 3726 3738 3250 3632 3415 3591 3787 3478
11JUL94 3482 3546 3196 3379 3559 3235 3549 3445 3413 3859
11JUL94 3330 3465 3994 3362 3309 3781 3211 3550 3637 3626
12JUL94 3152 3269 3431 3438 3575 3476 3115 3146 3731 3171
12JUL94 3206 3140 3562 3592 3722 3421 3471 3621 3361 3370
13JUL94 3421 3381 4040 3467 3475 3285 3619 3325 3317 3472
13JUL94 3296 3501 3366 3492 3367 3619 3550 3263 3355 3510
14JUL94 3795 3872 3559 3432 3322 3587 3336 3732 3451 3215
14JUL94 3594 3410 3335 3216 3336 3638 3419 3515 3399 3709
15JUL94 3850 3431 3460 3623 3516 3810 3671 3602 3480 3388
15JUL94 3365 3845 3520 3708 3202 3365 3731 3840 3182 3677
16JUL94 3711 3648 3212 3664 3281 3371 3416 3636 3701 3385
16JUL94 3769 3586 3540 3703 3320 3323 3480 3750 3490 3395
17JUL94 3596 3436 3757 3288 3417 3331 3475 3600 3690 3534
17JUL94 3306 3077 3357 3528 3530 3327 3113 3812 3711 3599
18JUL94 3428 3760 3641 3393 3182 3381 3425 3467 3451 3189
18JUL94 3588 3484 3759 3292 3063 3442 3712 3061 3815 3339
19JUL94 3746 3426 3320 3819 3584 3877 3779 3506 3787 3676
19JUL94 3727 3366 3288 3684 3500 3501 3427 3508 3392 3814
20JUL94 3676 3475 3595 3122 3429 3474 3125 3307 3467 3832
20JUL94 3383 3114 3431 3693 3363 3486 3928 3753 3552 3524
21JUL94 3349 3422 3674 3501 3639 3682 3354 3595 3407 3400
21JUL94 3401 3359 3167 3524 3561 3801 3496 3476 3480 3570
22JUL94 3618 3324 3475 3621 3376 3540 3585 3320 3256 3443
22JUL94 3415 3445 3561 3494 3140 3090 3561 3800 3056 3536
23JUL94 3421 3787 3454 3699 3307 3917 3292 3310 3283 3536
23JUL94 3756 3145 3571 3331 3725 3605 3547 3421 3257 3574
;

title 'Kilowatt Power Output Data';
proc print data=Turbine(obs=25);
run;

ods graphics off;
title 'Box Chart for Power Output';
symbol v=dot;
proc shewhart data=Turbine;
   boxchart KWatts*Day;
run;

title 'Box Chart for Power Output';
proc shewhart data=Turbine;
   boxchart KWatts*Day / controlstat = median;
run;

data Oilsum;
   input Day KWattsL KWatts1 KWattsX KWattsM
             KWatts3 KWattsH KWattsR KWattsN;
   informat Day date7. ;
   format Day date5. ;
   label Day    ='Date of Measurement'
         KWattsL='Minimum Power Output'
         KWatts1='25th Percentile'
         KWattsX='Average Power Output'
         KWattsM='Median Power Output'
         KWatts3='75th Percentile'
         KWattsH='Maximum Power Output'
         KWattsR='Range of Power Output'
         KWattsN='Subgroup Sample Size';
   datalines;
04JUL94 3180 3340.0 3487.40 3490.0 3610.0 4050 870 20
05JUL94 3179 3333.5 3471.65 3419.5 3605.0 3849 670 20
06JUL94 3304 3376.0 3488.30 3456.5 3604.5 3781 477 20
07JUL94 3045 3390.5 3434.20 3447.0 3550.0 3629 584 20
08JUL94 2968 3321.0 3475.80 3487.0 3611.5 3916 948 20
09JUL94 3047 3425.5 3518.10 3576.0 3615.0 3881 834 20
10JUL94 3002 3368.5 3492.65 3495.5 3621.5 3787 785 20
11JUL94 3196 3346.0 3496.40 3473.5 3592.5 3994 798 20
12JUL94 3115 3188.5 3398.50 3426.0 3568.5 3731 616 20
13JUL94 3263 3340.0 3456.05 3444.0 3505.5 4040 777 20
14JUL94 3215 3336.0 3493.60 3441.5 3616.0 3872 657 20
15JUL94 3182 3409.5 3563.30 3561.0 3719.5 3850 668 20
16JUL94 3212 3378.0 3519.05 3515.0 3682.5 3769 557 20
17JUL94 3077 3329.0 3474.20 3501.5 3599.5 3812 735 20
18JUL94 3061 3315.5 3443.60 3435.0 3614.5 3815 754 20
19JUL94 3288 3426.5 3586.35 3546.0 3762.5 3877 589 20
20JUL94 3114 3373.0 3486.45 3474.5 3635.5 3928 814 20
21JUL94 3167 3400.5 3492.90 3488.0 3582.5 3801 634 20
22JUL94 3056 3322.0 3432.80 3460.0 3561.0 3800 744 20
23JUL94 3145 3308.5 3496.90 3495.0 3652.0 3917 772 20
;

title 'Summary Data Set for Power Outputs';
proc print data=Oilsum(obs=5) noobs;
run;

options nogstyle;
goptions ftext='albany amt';
symbol color = salmon h = .8;
title 'Box Chart for Power Output';
proc shewhart history=Oilsum;
   boxchart KWatts*Day / cinfill  = ligr
                         cboxfill = ywh
                         cboxes   = dagr
                         cframe   = vligb
                         ranges;
run;
options gstyle;

title 'Summary Data Set for Power Output';
proc shewhart data=Turbine;
   boxchart KWatts*Day / outhistory = Turbhist
                         nochart;
run;

title 'Summary Data Set for Power Output';
proc print data=Turbhist(obs=5);
run;

proc shewhart data=Turbine;
   boxchart KWatts*Day / outhistory = Turbhist2
                         ranges
                         nochart;
run;

title 'Summary Data Set for Power Output';
proc print data=Turbhist2(obs=5) noobs;
run;

proc shewhart data=Turbine;
   boxchart KWatts*Day / outlimits=Turblim
                         nochart;
run;

title 'Control Limits for Power Output Data';
proc print data=Turblim noobs;
run;

proc shewhart data=Turbine;
   boxchart KWatts*Day / outlimits   = Turblim2
                         controlstat = median
                         nochart;
run;

title 'Control Limits for Power Output Data';
proc print data=Turblim2 noobs;
run;

title 'Summary Statistics and Control Limit Information';
proc shewhart data=Turbine;
   boxchart KWatts*Day / outtable=Turbtab
                         nochart;
run;

title 'Summary Statistics and Control Limit Information';
proc print data=Turbtab(obs=25) noobs;
run;

title 'Box Chart for Power Output';
proc shewhart table=Turbtab;
   boxchart KWatts*Day;
label _SUBX_ = 'Average Power Output';
run;

data Turbine2;
   informat Day date7.;
   format Day date5.;
   label KWatts='KW Output';
   input Day @;
   do i=1 to 10;
      input KWatts @;
      output;
   end;
   drop i;
   datalines;
24JUL94 4129 3364 3791 3995 3545 3191 3504 3830 3069 3412
24JUL94 3437 3488 3587 3246 3373 3248 3443 3662 3729 3701
25JUL94 3608 3673 3755 3554 3318 3391 3518 3311 3738 3403
25JUL94 3522 3902 3272 3255 4043 3768 3180 3355 3281 3422
26JUL94 3451 3610 3530 3475 3509 3116 3704 3079 3527 3714
26JUL94 3669 3779 3789 3267 3333 3709 3264 3614 3558 3615
27JUL94 3393 3305 3117 3634 3227 3367 3795 3526 3702 3491
27JUL94 3444 3471 3211 3772 3595 3633 3465 3493 3278 3864
28JUL94 3871 3497 3242 3429 3503 3283 3819 3615 3225 3266
28JUL94 3454 3563 3750 3465 3360 3365 3418 3669 3405 3674
29JUL94 3483 3317 3350 3305 3421 3502 3617 3491 3612 3711
29JUL94 3207 3711 3571 3626 3485 3659 3269 3413 3352 3127
30JUL94 3431 3603 3723 3316 3707 3618 3715 3502 3454 3409
30JUL94 3570 3451 3098 3721 3679 3426 3135 3501 3098 3461
31JUL94 3320 3174 3580 3668 3289 3347 3722 3168 3495 3495
31JUL94 3457 3797 3428 3675 3659 3277 3454 3590 3328 3998
01AUG94 3149 3344 3581 3433 3436 3356 3190 3787 3605 3323
01AUG94 3631 3325 3722 3293 3514 3939 3475 3483 3645 3139
02AUG94 3681 3631 3229 3572 3579 3688 3447 3114 3318 3788
02AUG94 3638 3546 3432 3873 3494 3842 3579 3796 3417 3363
03AUG94 3529 3492 3247 3323 3614 3851 3084 3502 3323 3640
03AUG94 3647 3402 3379 3624 3510 3365 3373 3921 3202 3709
04AUG94 3339 3658 3511 3710 3559 3623 3555 3475 3392 3808
04AUG94 3370 3674 3681 3461 3034 3627 3618 3587 3330 3286
05AUG94 3717 3547 3260 3225 3653 3416 3386 3276 3790 3498
05AUG94 3601 3611 3255 3427 3283 3852 3639 4139 3413 3273
06AUG94 3203 3257 3547 3740 3528 3320 3503 3489 3331 3562
06AUG94 3601 3390 3603 3683 3587 3485 3810 3741 3740 3685
07AUG94 3434 3446 3434 3680 3609 3463 3250 3712 3475 3335
07AUG94 3080 3774 3047 3756 3318 3549 3789 3692 3113 3605
08AUG94 3409 3451 3637 3397 3713 3285 3837 3455 3190 3541
08AUG94 3515 3544 3380 3654 3453 3644 3158 3190 2998 3306
09AUG94 3110 3485 3463 3400 3445 3394 3427 3993 3450 3725
09AUG94 3592 3443 3622 3916 3588 3236 3863 3615 3626 3643
10AUG94 3314 3489 3679 3622 3505 3910 3460 3968 3454 3799
10AUG94 3590 3747 3427 3582 3859 3596 3310 3449 3418 3150
11AUG94 3695 3733 3419 3872 3457 3427 3559 3476 3446 3463
11AUG94 3964 3555 3499 3766 3702 3446 3537 3609 3129 3421
12AUG94 3640 3302 3851 3414 3804 3541 3446 3356 3443 3659
12AUG94 3374 3481 3790 3672 3189 3395 3216 4202 3599 3405
;

title 'Box Chart for Power Output';
ods graphics on;
proc shewhart data=Turbine2 limits=Turblim;
   boxchart KWatts*Day / odstitle=title;
run;