spc

mChart

Description

The mChart action produces median charts for subgroup medians. This type of control chart is used to analyze the central tendency of a process. It is preferred over an X-bar chart when the distribution of the data is skewed or when preventing the influence of extreme values (outliers) is a priority. This action can also generate accompanying range charts (R charts) or standard deviation charts (S charts) to monitor process variability.

spc.mChart result=<results> status=<rc> / table={...}, processName="variable-name", processValue="variable-name", subgroupName="variable-name", subgroupValue="variable-name", allN=TRUE | FALSE, chartsTable={...}, ciAlpha=double, ciIndices=TRUE | FALSE, ciType="LOWER" | "TWOSIDED" | "UPPER", display={...}, exChart=TRUE | FALSE, groupByLimit=64-bit-integer, limitN=integer, limitsTable={...}, medCentral="AVGMEAN" | "AVGMED" | "MEDMED", no3SigmaCheck=TRUE | FALSE, outLimitsTable={...}, outputTables={...}, primaryTests={...}, sigmas=double, sMethod="RMSDF" | "RMVLUE" | "RNOWEIGHT" | "SMVLUE" | "SNOWEIGHT", specsTable={...}, 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 that is used to compute capability index confidence limits.
ciIndicesWhen set to True, computes capability index confidence limits that are based on subgroup summary data.
ciTypeSpecifies the type of confidence limits that are computed for capability indices: lower, upper, or two-sided.
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 occur.
groupByLimitSuppresses the analysis if the number of groups exceeds the specified value.
limitNSpecifies a nominal sample size for the control limits.
limitsTableSpecifies the control limits data table.
medCentralSpecifies the method of estimating the process mean.
no3SigmaCheckWhen set to True, enables tests for special causes when the control limits are not three sigma limits.
outLimitsTableSpecifies the output control limits data table.
outputTablesLists the names of results tables to save as CAS tables on the server.
primaryTestsRequests one or more tests for special causes 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 of estimating the process standard deviation.
specsTableSpecifies the specification limits data table and computes 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.
tableSpecifies the settings for an input table.
test2RunSpecifies the length of the pattern for Test 2.
test3RunSpecifies the length of the pattern for Test 3.
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
Creating Sample Piston Diameter Data

This SAS DATA step generates a sample dataset named 'mycas.pistons'. It simulates the diameter measurements of piston rings, organized into 20 subgroups (by Hour) of five measurements each. A known process shift is introduced in the second half of the data to demonstrate how the control chart detects changes.

Copied!
1DATA mycas.pistons;
2 label hour='Hour' diameter='Diameter (in cm)';
3 keep hour diameter;
4 DO hour = 1 to 20;
5 DO i = 1 to 5;
6 IF (hour < 11) THEN diameter = 5.0 + rannor(1234);
7 ELSE diameter = 5.5 + rannor(1234);
8 OUTPUT;
9 END;
10 END;
11RUN;

Examples

This example creates a basic median (m) chart for the `pistons` data set. The chart plots the subgroup medians of the `diameter` variable, with subgroups defined by the `hour` variable. This helps monitor whether the process center is stable over time.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 spc.mChart /
3 TABLE={name='pistons'},
4 processValue='diameter',
5 subgroupValue='hour';
6RUN;
Result :
The action produces a median chart and a summary table. The chart displays the median diameter for each hour, along with a central line and control limits, allowing for visual inspection of process stability. A clear shift in the median values should be visible around Hour 11.

This example creates a median chart and an accompanying range chart (since subgroup sizes are less than 10). It applies several tests for special causes (Tests 1, 2, and 3) to formally detect patterns indicating an out-of-control process. The results, including chart data and control limits, are saved to `mycas.PistonCharts` and `mycas.PistonLimits` respectively for further analysis or reporting.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 spc.mChart /
3 TABLE={name='pistons'},
4 processValue='diameter',
5 subgroupValue='hour',
6 primaryTests={test1=true, test2=true, test3=true},
7 chartsTable={name='PistonCharts', replace=true},
8 outLimitsTable={name='PistonLimits', replace=true};
9RUN;
Result :
This code generates a median chart and a range chart. The median chart will highlight points violating the specified tests, particularly Test 1 (points outside control limits) and Test 2 (a run of points on one side of the center line) due to the introduced process shift. Additionally, two new CAS tables, `PistonCharts` and `PistonLimits`, will be created in the `mycas` caslib containing detailed chart summary statistics and control limit parameters.

FAQ

What is the purpose of the spc.mChart action?
What is the primary input table for the mChart action?
How can I specify the method for estimating the process standard deviation?
How is the central line on the median chart estimated?
Can the mChart action perform tests for special causes (Western Electric rules)?
What does the 'limitN' parameter do?
How can I save the control limits to an output table?
Is it possible to generate a chart only when control limits are exceeded?