spc

maChart

Description

The maChart action produces a uniformly weighted moving average (MA) chart. This type of chart is used to monitor a process by displaying the average of the measurements from a specified number of consecutive subgroups. It is particularly useful for detecting small shifts in the process mean over time.

spc.maChart / table={name='<table_name>'}, processValue='<process_variable>', subgroupValue='<subgroup_variable>', span=<number_of_subgroups>;
Settings
ParameterDescription
allN When set to True, includes all subgroups regardless of whether the subgroup sample size equals the nominal sample size.
asymptotic When set to True, produces asymptotic control limits.
chartsTable Specifies the CAS output table to store the charts summary.
display Specifies a list of results tables to send to the client for display.
exChart When set to True, includes a control chart in the results only when exceptions (out-of-control points) occur.
groupByLimit Suppresses the analysis if the number of groups exceeds the specified value.
limitN Specifies a nominal sample size for the control limits when sample sizes are variable.
limitsTable Specifies an input CAS table that contains pre-established control limits.
outLimitsTable Specifies the CAS output table to store the calculated control limits.
outputTables Lists the names of results tables to save as CAS tables on the server.
processName Specifies the variable in the input data table that contains the names of processes to be analyzed.
processValue Specifies the variable in the input data table that contains the process measurements to be analyzed.
sigmas Specifies the width of the control limits as a multiple of the standard error of the subgroup summary statistic.
sMethod Specifies the method for estimating the process standard deviation. Values can be 'RMSDF' (weighted root mean square), 'SMVLUE' (minimum variance linear unbiased estimate), or 'SNOWEIGHT' (unweighted).
span Specifies the number of subgroups (span) used to calculate the moving average. This parameter is required.
subgroupName Specifies the variable in the input data table that contains the names of subgroup variables.
subgroupValue Specifies the variable in the input data table that contains the subgroup values.
table Specifies the input CAS table containing the process data.
Data Preparation View data prep sheet
Creating a Sample Dataset

This example creates a sample CAS table named 'parts' containing diameter measurements for parts manufactured over 15 days. Each day represents a subgroup with 5 measurements.

Copied!
1DATA mycas.parts;
2DO day = 1 to 15;
3 DO i = 1 to 5;
4 diameter = 10 + rannor(1234);
5 OUTPUT;
6 END;
7END;
8RUN;

Examples

This example generates a simple moving average chart with a span of 3 subgroups. It uses the 'parts' table created previously, analyzing the 'diameter' variable with 'day' as the subgrouping variable.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 spc.maChart /
3 TABLE={name='parts'},
4 processValue='diameter',
5 subgroupValue='day',
6 span=3;
7RUN;
Result :
The action will produce several result tables, including 'DescriptiveStatistics', 'Limits', and 'Charts', which contains the data for plotting the moving average chart. By default, it will also display the chart graphically in the results.

This example creates a moving average chart with a wider span of 5 subgroups. It sets control limits at 3.5 standard errors (sigmas=3.5) and uses the RMSDF method to estimate process standard deviation. The control limits are saved to a CAS table named 'maLimits', and the chart summary data is saved to 'maChartSummary'.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 spc.maChart /
3 TABLE={name='parts'},
4 processValue='diameter',
5 subgroupValue='day',
6 span=5,
7 sigmas=3.5,
8 sMethod='RMSDF',
9 outLimitsTable={name='maLimits', replace=true},
10 chartsTable={name='maChartSummary', replace=true};
11RUN;
Result :
This will produce the moving average chart and its associated data tables. Additionally, two new CAS tables will be created in the current caslib: 'maLimits' containing the control limit parameters and 'maChartSummary' containing the plotted chart data.

FAQ

What is the primary function of the maChart action?
How is the process standard deviation estimated in the maChart action?
What does the `span` parameter control?
What is the purpose of the `limitN` parameter?
How can I handle subgroups with varying sample sizes?
What is the difference between the `limitsTable` and `outLimitsTable` parameters?