Statistical Process Control Action Set
Applying Tests for Special Causes
This section contains PROC CAS code.
Note: Input data must be accessible in your CAS session, either as a CAS table or as a transient-scope table. A CAS table has a two-level name: the first level is your CAS engine libref, and the second level is the table name. You refer to this table in the CAS procedure by specifying only the second level. For more information about two-level names, see Chapter 2, Shared Concepts. A transient-scope table is called directly from the action and exists in memory for the duration of the action. For more information about accessing data, see SAS Viya: System Programming Guide. For more information about PROC CAS and programming in CASL, see SAS Cloud Analytic Services: CASL Programmer’s Guide and SAS Cloud Analytic Services: CASL Reference.
The following statements use the mycas.Random data table from Example 26.1 and request tests for special causes in the analysis:
ods trace on;
proc cas;
action spc.xChart /
table='Random'
exChart=true
primaryTests={test1=true test2=true test3=true test4=true};
run;
The primaryTests parameter applies Test1–Test4 to the charts. Processes for which any of these tests are positive are included in the "Exception Summary" table, which is shown in Output 26.2.1.
Output 26.2.1: Results of Tests for Special Causes
| Means Chart Summary for RANDOM | ||||||||
|---|---|---|---|---|---|---|---|---|
| processname | subgroupname | Number of Subgroups | Number > UCL | Number < LCL | Test 1 Signals | Test 2 Signals | Test 3 Signals | Test 4 Signals |
| Process006 | Subgroup006 | 30 | 0 | 1 | 1 | 0 | 0 | 0 |
| Process011 | Subgroup011 | 30 | 1 | 0 | 1 | 0 | 1 | 0 |
| Process015 | Subgroup015 | 30 | 0 | 1 | 1 | 0 | 0 | 0 |
| Process021 | Subgroup021 | 30 | 1 | 0 | 1 | 0 | 0 | 0 |
| Process031 | Subgroup031 | 30 | 0 | 0 | 0 | 1 | 0 | 0 |
| Process032 | Subgroup032 | 30 | 1 | 0 | 1 | 0 | 0 | 0 |
| Process034 | Subgroup034 | 30 | 0 | 0 | 0 | 0 | 1 | 0 |
| Process047 | Subgroup047 | 30 | 0 | 0 | 0 | 0 | 2 | 0 |
| Process048 | Subgroup048 | 30 | 0 | 0 | 0 | 0 | 0 | 1 |
| Process066 | Subgroup066 | 30 | 0 | 0 | 0 | 0 | 0 | 1 |
| Process069 | Subgroup069 | 30 | 0 | 0 | 0 | 0 | 1 | 0 |
| Process074 | Subgroup074 | 30 | 0 | 0 | 0 | 0 | 0 | 1 |
| Process078 | Subgroup078 | 30 | 0 | 1 | 1 | 0 | 0 | 0 |
| Process079 | Subgroup079 | 30 | 0 | 0 | 0 | 0 | 1 | 0 |
| Process080 | Subgroup080 | 30 | 0 | 1 | 1 | 0 | 0 | 0 |
| Process081 | Subgroup081 | 30 | 0 | 0 | 0 | 0 | 1 | 0 |
| Process089 | Subgroup089 | 30 | 1 | 0 | 1 | 0 | 0 | 0 |
| Process092 | Subgroup092 | 30 | 1 | 0 | 1 | 0 | 0 | 0 |
| Process099 | Subgroup099 | 30 | 0 | 0 | 0 | 0 | 1 | 0 |
Nineteen of the 100 processes are flagged for at least one exception: a subgroup mean outside the control limits or a positive test result. Because these data were simulated from a normal distribution, they represent processes that are in statistical control. Therefore, you should regard all these exceptions as false positives.
The combined chance of a false signal when Tests 1–4 are applied together is less than 1 in 100 (see the section Interpreting Tests for Special Causes). Therefore, finding 21 exceptions in an analysis of 3,000 total subgroups is not unexpected.
Applying Tests for Special Causes
This section contains Lua code for the analysis in the CASL version of this example, which contains details about the results.
Note: In order to run this code, the data that are described in the CASL version need to be accessible to the CAS server. One way to do this is to convert the Random data to the comma-separated-value (CSV) file Random.csv and then use the following code to load the CSV file into CAS:
s:loadtable{casLib="casuser", path="Random.csv"}
For more information about coding in Lua, see Getting Started with SAS Viya for Lua and SAS Viya: System Programming Guide.
The following code loads the spc action set and then uses the xChart action to perform an chart analysis of the data:
s:loadactionset{actionset='spc'}
r=s:xChart{
table='Random',
exChart=true,
primaryTests={test1=true,test2=true,test3=true,test4=true}}
The primaryTests parameter applies tests for special causes Test1–Test4 to the chart.
The following command displays the table that is produced by this action call:
r
For more information about the results of this analysis, see the CASL version of this example.
Applying Tests for Special Causes
This section contains Python code for the analysis in the CASL version of this example, which contains details about the results.
Note: In order to run this code, the data that are described in the CASL version need to be accessible to the CAS server. One way to do this is to convert the Random data to the comma-separated-value (CSV) file Random.csv and then use the following code to load the CSV file into CAS:
s.upload_file('Random.csv')
For more information about coding in Python, see Getting Started with SAS Viya for Python and SAS Viya: System Programming Guide.
The following code loads the spc action set and then uses the xChart action to perform an chart analysis of the data:
s.loadactionset(actionset='spc')
r=s.xChart(
table='Random'
exChart=true
primaryTests=('test1':'true','test2':'true','test3:'true','test4':'true'))
The primaryTests parameter applies tests for special causes Test1–Test4 to the chart.
The following command displays the table that is produced by this action call:
print(r)
For more information about the results of this analysis, see the CASL version of this example.
Applying Tests for Special Causes
This example is not available for the R programming language.