The SHEWHART Procedure |
[See SHWSVAR in the SAS/QC Sample Library]As an alternative to reading a LIMITS= data set and using a WHERE statement, you can provide two special switch variables named _COMP_ and _DISP_ in the input data set. The rules for using these variables are as follows:
Switch variables must be character variables of length one. Valid values for these variables are 'Y' (or 'y') and 'N' (or 'n'). A blank value is treated as 'Y'.
Subgroups for which _COMP_ is equal to 'Y' are included in computations of parameter estimates and control limits, and observations for which _COMP_ is equal to 'N' are excluded.
Subgroups for which _DISP_ is equal to 'Y' are displayed on the chart, and subgroups for which _DISP_ is equal to 'N' are not displayed.
If the chart statement creates a chart for variables, you can provide two additional switch variables named _COMP2_ and _DISP2_, which are defined similarly to _COMP_ and _DISP_. In this case, the variable _COMP_ specifies which subgroups are used to estimate the process mean , and the variable _COMP2_ specifies which subgroups are used to estimate the process standard deviation . The variable _DISP_ specifies which subgroups are displayed on the primary chart ( chart, median chart, or individual measurements chart), and the variable _DISP2_ specifies which subgroups are displayed on the secondary chart ( chart or chart).
The variables _COMP_ and _COMP2_ are not applicable when control limits or control limit parameters are read from a LIMITS= data set.
The variables _DISP_ and _DISP2_ take precedence over the display controlled by the LIMITN= and ALLN options.
If the input data set is a DATA= data set with multiple observations per subgroup, switch variable values must be constant within a subgroup.
Switch variables are saved in OUTHISTORY= and OUTTABLE= data sets. Subgroups for which _DISP_ is equal to 'N' are not saved in an OUTTABLE= data set, and such subgroups are not displayed in tables created with the TABLE and related options.
The following statements illustrate how the switch variables _COMP_ and _DISP_ can be used with the bottle production data:
data bottles; length _comp_ _disp_ $ 1; set Bottles; if Day = '13JAN94'D then _comp_ = 'n'; else if Day = '14JAN94'D then _comp_ = 'n'; else if Day <= '31JAN94'D then _comp_ = 'y'; else _comp_ = 'n'; if Day <= '31JAN94'D then _disp_ = 'n'; else _disp_ = 'y'; run; title 'Analysis of February Production'; proc shewhart data=Bottles; pchart nCracks * day / subgroupn = nBottles nolegend nohlabel; label nCracks = 'Proportion With Cracks'; run;
The chart is identical to the chart in Figure 13.43.60.
In general, switch variables are more versatile than WHERE statements in applications where subgroups are simultaneously selected for computation and display. Switch variables also provide a permanent record of which subgroups were selected. The WHERE statement does not alter the input data set; it simply restricts the observations that are read; consequently, the WHERE statement can be more efficient than switch variables for processing large data sets.
Copyright © SAS Institute, Inc. All Rights Reserved.