Standard Deviation Chart (s Chart) Example

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SHWSCHR                                             */
/*   TITLE: Standard Deviation Chart (s Chart) Example          */
/* PRODUCT: QC                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: Shewhart Charts,Standard Deviation Charts,s 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.;
   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;
symbol v=dot h=.8;
title 'Chart for Standard Deviations of Power Output';
proc shewhart data=Turbine;
   schart KWatts*Day;
run;

data Oilsum;
   input Day KWattsX KWattsS KWattsN;
   informat Day date7. ;
   format Day date5. ;
   label Day   ='Date of Measurement';
   datalines;
 04JUL94 3487.40 220.260 20
 05JUL94 3471.65 210.427 20
 06JUL94 3488.30 147.025 20
 07JUL94 3434.20 157.637 20
 08JUL94 3475.80 258.949 20
 09JUL94 3518.10 211.566 20
 10JUL94 3492.65 193.779 20
 11JUL94 3496.40 212.024 20
 12JUL94 3398.50 199.201 20
 13JUL94 3456.05 173.455 20
 14JUL94 3493.60 187.465 20
 15JUL94 3563.30 205.472 20
 16JUL94 3519.05 173.676 20
 17JUL94 3474.20 200.576 20
 18JUL94 3443.60 222.084 20
 19JUL94 3586.35 185.724 20
 20JUL94 3486.45 223.474 20
 21JUL94 3492.90 145.267 20
 22JUL94 3432.80 190.994 20
 23JUL94 3496.90 208.858 20
;

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

options nogstyle;
goptions ftext='albany amt';
title 'Chart for Standard Deviations of Power Output';
proc shewhart history=Oilsum;
   schart KWatts*Day / cframe  = vligb
                       cinfill = ywh
                       cconnect = salmon;
run;
options gstyle;

proc shewhart data=Turbine;
   schart KWatts*Day / outhistory = Turbhist
                       nochart;
run;

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

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

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

proc shewhart data=Turbine;
   schart KWatts*Day / outtable=Turbtab
                       nochart;
run;

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

title 'Chart for Standard Deviations of Power Output';
symbol v=dot;
proc shewhart table=Turbtab;
   schart KWatts*Day;
run;


data Turbine2;
   informat Day date7.;
   format Day date5.;
   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
;



ods graphics on;
title 'Chart for Standard Deviations of Power Output';
proc shewhart data=Turbine2 limits=Turblim;
   schart KWatts*Day / odstitle=title;
run;