spc

boxChart

Description

The boxChart action produces box charts, which are a type of statistical process control (SPC) chart. These charts are used to analyze the variation of a process over time by plotting summary statistics for data collected in subgroups. A box chart displays the distribution of a process variable for each subgroup, typically showing the minimum, first quartile, median, third quartile, and maximum values. This allows for the visual assessment of process stability and the identification of special causes of variation.

spc.boxChart { allN=TRUE | FALSE, chartsTable={...}, ciAlpha=double, ciIndices=TRUE | FALSE, ciType="LOWER" | "TWOSIDED" | "UPPER", controlStat="MEAN" | "MEDIAN", display={...}, exChart=TRUE | FALSE, groupByLimit=64-bit-integer, limitN=integer, limitsTable={...}, medCentral="AVGMEAN" | "AVGMED" | "MEDMED", no3SigmaCheck=TRUE | FALSE, outLimitsTable={...}, outputTables={...}, pctlDef=integer, primaryTests={...}, processName="variable-name", processValue="variable-name", sigmas=double, sMethod="RMSDF" | "RMVLUE" | "RNOWEIGHT" | "SMVLUE" | "SNOWEIGHT", specsTable={...}, subgroupName="variable-name", subgroupValue="variable-name", table={...}, test2Run=integer, test3Run=integer, testNStd=TRUE | FALSE, testOverlap=TRUE | FALSE };
Settings
ParameterDescription
allNWhen set to True, includes all subgroups regardless of whether the subgroup sample size equals the nominal sample size.
chartsTableSpecifies the charts summary output data table.
ciAlphaSpecifies the confidence level used to compute capability index confidence limits.
ciIndicesWhen set to True, computes capability index confidence limits based on subgroup summary data.
ciTypeSpecifies the type of confidence limits (LOWER, UPPER, or TWOSIDED) computed for capability indices.
controlStatSpecifies whether box chart control limits are computed for subgroup means or subgroup medians.
displaySpecifies a list of results tables to send to the client for display.
exChartWhen set to True, includes a control chart in the results only when exceptions (out-of-control points) occur.
groupByLimitSuppresses the analysis if the number of groups exceeds the specified value.
limitNSpecifies a nominal sample size for the control limits.
limitsTableSpecifies the input data table that contains pre-calculated control limits.
medCentralSpecifies the method for estimating the process mean (central line), such as the average of subgroup means (AVGMEAN), average of subgroup medians (AVGMED), or median of subgroup medians (MEDMED).
no3SigmaCheckWhen set to True, enables tests for special causes even when the control limits are not the default three-sigma limits.
outLimitsTableSpecifies the output data table to store the calculated control limits.
outputTablesLists the names of results tables to save as CAS tables on the server.
pctlDefSpecifies the definition used to calculate percentiles for constructing the box-and-whisker plots.
primaryTestsRequests one or more tests for special causes (e.g., points outside control limits, trends, runs) for the primary control chart.
processNameSpecifies the variable in the input data table that contains the names of processes to be analyzed.
processValueSpecifies the variable in the input data table that contains the process measurements to be analyzed.
sigmasSpecifies the width of the control limits as a multiple of the standard error of the subgroup summary statistic.
sMethodSpecifies the method for estimating the process standard deviation, such as using subgroup ranges or standard deviations.
specsTableSpecifies the data table containing specification limits, used to compute process capability indices.
subgroupNameSpecifies the variable in the input data table that contains the names of subgroup variables.
subgroupValueSpecifies the variable in the input data table that contains the subgroup values (e.g., time, batch number).
tableSpecifies the input data table containing the process data.
test2RunSpecifies the length of the pattern for Test 2 (points in a row on one side of the center line).
test3RunSpecifies the length of the pattern for Test 3 (points in a row steadily increasing or decreasing).
testNStdWhen set to True, enables tests for special causes with varying subgroup sample sizes.
testOverlapWhen set to True, applies tests for special causes to overlapping patterns of points.
Data Preparation View data prep sheet
Data Creation

This example creates a CAS table named `mycas.PistonRings`. This table contains diameter measurements of piston rings. Each subgroup consists of five measurements taken on a specific day. The `Day` variable identifies the subgroup.

Copied!
1DATA mycas.PistonRings;
2 DO Day = 1 to 20;
3 DO i = 1 to 5;
4 Diameter = 74 + 0.02 * rannor(1234);
5 OUTPUT;
6 END;
7 END;
8RUN;

Examples

This example generates a basic box chart for the `Diameter` measurements in the `mycas.PistonRings` table, with subgroups defined by the `Day` variable. The control limits are calculated based on the data.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 spc.boxChart /
3 TABLE={name='PistonRings'},
4 processValue='Diameter',
5 subgroupValue='Day';
6RUN;

This example creates a box chart and saves the control limits to a CAS table named `mycas.PistonLimits`. It also applies Test 1 (points outside control limits) and Test 3 (six points in a row steadily increasing or decreasing) to identify special causes of variation.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 spc.boxChart /
3 TABLE={name='PistonRings'},
4 processValue='Diameter',
5 subgroupValue='Day',
6 outLimitsTable={name='PistonLimits', replace=true},
7 primaryTests={test1=true, test3=true};
8RUN;

This example first creates a control limits table (`mycas.PistonLimits`) and then uses it to create a box chart. It specifies that the chart should be based on subgroup medians (`controlStat='MEDIAN'`) and uses the pre-calculated limits from the `limitsTable` parameter.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 spc.boxChart /
3 TABLE={name='PistonRings'},
4 processValue='Diameter',
5 subgroupValue='Day',
6 outLimitsTable={name='PistonLimits', replace=true};
7 
8 spc.boxChart /
9 TABLE={name='PistonRings'},
10 processValue='Diameter',
11 subgroupValue='Day',
12 limitsTable={name='PistonLimits'},
13 controlStat='MEDIAN';
14RUN;

FAQ

What is the primary function of the boxChart action?
What does the 'controlStat' parameter control in a box chart?
How can I specify the estimation method for the process standard deviation?
Which tests for special causes can be performed with the boxChart action?
How are varying subgroup sample sizes handled?
What is the purpose of the 'specsTable' parameter?
What is the difference between the 'chartsTable' and 'outLimitsTable' output tables?

Associated Scenarios

Use Case
Standard Case: Manufacturing Process Capability Analysis

A manufacturing plant produces high-precision engine pistons. The engineering team needs to monitor the diameter of the pistons from a specific production line (Line A) to ensur...

Use Case
Performance Case: Large-Scale Monitoring Across Multiple Production Lines

A large pharmaceutical company monitors the purity level of a drug produced across 100 parallel production lines. To manage this scale, they only want to generate charts for lin...

Use Case
Edge Case: Handling Missing Data and Varying Subgroup Sizes

A bottling plant monitors the fill volume of juice bottles. Due to intermittent sensor failures, some measurements are missing. Additionally, for quality checks, the number of b...