BOXCHART Statement: SHEWHART Procedure

Input Data Sets

DATA= Data Set

You can read raw data (process measurements) from a DATA= data set specified in the PROC SHEWHART statement. Each process specified in the BOXCHART statement must be a SAS variable in the data set. This variable provides measurements which must be grouped into subgroup samples indexed by the subgroup-variable. The subgroup-variable, specified in the BOXCHART statement, must also be a SAS variable in the DATA= data set. Each observation in a DATA= data set must contain a value for each process and a value for the subgroup-variable. If the ith subgroup contains $n_ i$ measurements, there should be $n_ i$ consecutive observations for which the value of the subgroup-variable is the index of the ith subgroup. For example, if each subgroup contains 20 items and there are 30 subgroup samples, the DATA= data set should contain 600 observations. Other variables that can be read from a DATA= data set include

  • _PHASE_ (if READPHASES= is specified)

  • block-variables

  • symbol-variable

  • BY variables

  • ID variables

By default, the SHEWHART procedure reads all of the observations in a DATA= data set. However, if the data set includes the variable _PHASE_, you can read selected groups of observations (referred to as phases) with the READPHASES= option for an example, see Displaying Stratification in Phases.

For an example of a DATA= data set, see Creating Box Charts from Raw Data.

LIMITS= Data Set

You can read preestablished control limits (or parameters from which the control limits can be calculated) from a LIMITS= data set specified in the PROC SHEWHART statement. For example, the following statements read control limit information from the data set Conlims:

proc shewhart data=Info limits=Conlims;
   boxchart Weight*Batch;
run;

The LIMITS= data set can be an OUTLIMITS= data set that was created in a previous run of the SHEWHART procedure. Such data sets always contain the variables required for a LIMITS= data set; see Table 18.7. The LIMITS= data set can also be created directly using a DATA step. When you create a LIMITS= data set, you must provide one of the following:

  • the variables _LCLX_, _MEAN_, and _UCLX_ or (if you specify CONTROLSTAT=MEDIAN) the variables _LCLM_, _MEAN_, and _UCLM_. These variables specify the control limits directly.

  • the variables _MEAN_ and _STDDEV_, which are used to calculate the control limits according to the equations in Table 18.6

In addition, note the following:

  • The variables _VAR_ and _SUBGRP_ are required. These must be character variables whose lengths are no greater than 32.

  • The variable _INDEX_ is required if you specify the READINDEX= option; this must be a character variable whose length is no greater than 48.

  • The variables _LIMITN_, _SIGMAS_ (or _ALPHA_), and _TYPE_ are optional, but they are recommended to maintain a complete set of control limit information. The variable _TYPE_ must be a character variable of length 8; valid values are 'ESTIMATE', 'STANDARD', 'STDMU', and 'STDSIGMA'.

  • BY variables are required if specified with a BY statement.

For an example, see Reading Preestablished Control Limits.

HISTORY= Data Set

You can read subgroup summary statistics from a HISTORY= data set specified in the PROC SHEWHART statement. This enables you to reuse OUTHISTORY= data sets that have been created in previous runs of the SHEWHART, CUSUM, or MACONTROL procedures or to read output data sets created with SAS summarization procedures, such as PROC UNIVARIATE.

A HISTORY= data set used with the BOXCHART statement must contain the following:

  • the subgroup-variable

  • a subgroup minimum variable for each process

  • a subgroup first-quartile variable for each process

  • a subgroup median variable for each process

  • a subgroup mean variable for each process

  • a subgroup third-quartile variable for each process

  • a subgroup maximum variable for each process

  • a subgroup sample size variable for each process

  • either a subgroup range variable or a subgroup standard deviation variable for each process

If you specify the RANGES option, the subgroup range variable must be included; otherwise, the subgroup standard deviation variable must be included.

The names of the subgroup summary statistics variables must be the process name concatenated with the following special suffix characters:

Subgroup Summary Statistic

Suffix Character

subgroup Minimum

L

subgroup First-quartile

1

subgroup Median

M

subgroup Mean

X

subgroup Third-quartile

3

subgroup Maximum

H

subgroup Sample size

N

subgroup Range

R

subgroup Standard deviation

S

For example, consider the following statements:

proc shewhart history=summary;
   boxchart (weight Yieldstrength)*batch;
run;

The data set Summary must include the variables Batch, WeightL, Weight1, WeightM, WeightX, Weight3, WeightH, WeightS, WeightN, YieldstrengthL, Yieldstrength1, YieldstrengthM, YieldstrengthX, Yieldstrength3, YieldstrengthH, YieldstrengthS, and YieldstrengthN.

If the RANGES option were specified in the preceding BOXCHART statement, it would be necessary for Summary to include the variables WeightR and YieldstrengthR rather than WeightS and YieldstrengthS.

Note that if you specify a process name that contains 32 characters, the names of the summary variables must be formed from the first 16 characters and the last 15 characters of the process name, suffixed with the appropriate character.

Other variables that can be read from a HISTORY= data set include

  • _PHASE_ (if READPHASES= is specified)

  • block-variables

  • symbol-variable

  • BY variables

  • ID variables

By default, the SHEWHART procedure reads all of the observations in a HISTORY= data set. However, if the data set includes the variable _PHASE_, you can read selected groups of observations (referred to as phases) with the READPHASES= option (see Displaying Stratification in Phases for an example).

For an example of a HISTORY= data set, see Creating Box Charts from Subgroup Summary Data.

TABLE= Data Set

You can read summary statistics and control limits from a TABLE= data set specified in the PROC SHEWHART statement. This enables you to reuse an OUTTABLE= data set created in a previous run of the SHEWHART procedure. Because the SHEWHART procedure simply displays the information in a TABLE= data set, you can use TABLE= data sets to create specialized control charts. Examples are provided in Specialized Control Charts: SHEWHART Procedure.

Table 18.10 lists the variables required in a TABLE= data set used with the BOXCHART statement:

Table 18.10: Variables Required in a TABLE= Data Set

Variable

Description

_LCLM_

Lower control limit for median

_LCLX_

Lower control limit for mean

_LIMITN_

Nominal sample size associated with the control limits

_MEAN_

Process mean

Subgroup-variable

Values of the subgroup-variable

_SUBMAX_

Subgroup maximum

_SUBMIN_

Subgroup minimum

_SUBMED_

Subgroup median

_SUBN_

Subgroup sample size

_SUBQ1_

Subgroup first quartile (25th percentile)

_SUBQ3_

Subgroup third quartile (75th percentile)

_SUBX_

Subgroup mean

_UCLM_

Upper control limit for median

_UCLX_

Upper control limit for mean


Note that if you specify CONTROLSTAT= MEDIAN, the variables _LCLM_, _SUBMED_, and _UCLM_ are required; otherwise, the variables _LCLX_, _SUBX_, and _UCLX_ are required.

Other variables that can be read from a TABLE= data set include

  • block-variables

  • symbol-variable

  • BY variables

  • ID variables

  • _PHASE_ (if the READPHASES= option is specified). This variable must be a character variable whose length is no greater than 48.

  • _TESTS_ (if the TESTS= option is specified). This variable is used to flag tests for special causes and must be a character variable of length 8.

  • _VAR_. This variable is required if more than one process is specified or if the data set contains information for more than one process. This variable must be a character variable whose length is no greater than 32.

For an example of a TABLE= data set, see Saving Control Limits.

BOX= Data Set

You can read summary statistics, control limits, and outlier values from a BOX= data set specified in the PROC SHEWHART statement. This enables you to reuse an OUTBOX= data set created in a previous run of the SHEWHART procedure to display a box chart.

A BOX= data set must contain the following variables:

  • the group variable

  • _VAR_, containing the process variable name

  • _TYPE_, identifying features of box-and-whisker plots

  • _VALUE_, containing values of those features

Each observation in a BOX= data set records the value of a single feature of one subgroup’s box-and-whisker plot, such as its mean. The _TYPE_ variable identifies the feature whose value is recorded in a given observation. Table 18.11 lists valid _TYPE_ variable values:

Table 18.11: Valid _TYPE_ Values in a BOX= Data Set

Value

Description

N

Subgroup size

SIGMAS

Multiple (k) of standard error of $\bar{X}_{i}$ or $M_{i}$

ALPHA

Probability ($\alpha $) of exceeding limits

LIMITN

Nominal sample size associated with control limits

LCLM

Lower control limit for subgroup median

LCLX

Lower control limit for subgroup mean

UCLM

Upper control limit for subgroup median

UCLX

Upper control limit for subgroup mean

PROCMED

Process median

PROCMEAN

Process mean

EXLIM

Control limit exceeded on box chart

TREND

Trend variable value

MIN

Minimum subgroup value

Q1

Subgroup first quartile

MEDIAN

Subgroup median

MEAN

Subgroup mean

Q3

Subgroup third quartile

MAX

Subgroup maximum value

LOW

Low outlier value

HIGH

High outlier value

LOWHISKR

Low whisker value, if different from MIN

HIWHISKR

High whisker value, if different from MAX

FARLOW

Low far outlier value

FARHIGH

High far outlier value


The features identified by the _TYPE_ values N, LCLM or LCLX, UCLM or UCLX, PROCMED or PROCMEAN, MIN, Q1, MEDIAN, MEAN, Q3, and MAX are required for each subgroup.

Other variables that can be read from a BOX= data set include:

  • the variable _ID_, containing labels for outliers

  • the variable _HTML_, containing links to be associated with features on box plots

  • block-variables

  • symbol-variable

  • BY variables

  • ID variables

When you specify one of the keywords SCHEMATICID or SCHEMATICIDFAR with the BOXSTYLE= option, values of _ID_ are used as outlier labels. If _ID_ does not exist in the BOX= data set, the values of the first variable listed in the ID statement are used.