Control charts are traditionally used for monitoring process stability and control. The elements of a control chart include:
Beyond manufacturing, control charts can be useful for monitoring changes in fraud over time, such as changes in the frequency of fraudulent transactions, the percentage of fraudulent transaction, and the funds lost due to fraud. Moving above the UCL could set off alarms for human intervention to improve an existing fraud model or create new fraud rules. Monitoring before and after model or rule changes can help determine the effectiveness of those changes. The applications of control charts in fraud monitoring could help organizations save money, so let’s discuss how to create a control chart in Visual Analytics on Viya. Before moving on, if you are interested in a more in-depth primer to control charts or want to build control charts in SAS Studio, please see this video.
Out-of-the-box, SAS Visual Analytics on Viya does not include a control chart object. In addition, the reference lines in the time series object are static – they will not dynamically change as the data changes. But that is not a problem for us! To create a dynamic control chart, meaning a chart that changes the average, UCL, and LCL lines, based on a rolling date period, we will build a custom graph, make calculated items, and filter the chart by date. In-depth step-by-step instructions on creating controls charts in SAS Visual Analytics on Viya are below!
First, we must build a custom time series graph that includes three additional series lines. To build a custom graph, do the following:
To use the custom chart in Visual Analytics, do the following:
Prior to creating calculated items, you need to decide your time period and time frequency. In this example, I will be making these calculations on a daily frequency and will represent the chosen time period as the “Number_of_Days” from today.
To create a calculated item, do the following:
The Control Chart Measure represents what you are monitoring. In the following example, I will look at frequency, but you can modify the calculations to look at percentage or costs. The chart will be filtered to only include the monitoring period and when an aggregated item is applied to an object, it will only aggregate the observations in that object.
To create Control_Chart_Measure, do the following:
Control Chart Average
To create Control_Chart_Average, do the following:
Sigma represents the standard deviation within this time period. Standard deviation can be calculated as square root of the the sum of the differences between the mean and the actual value squared divided by the number of observations. This piece is the most complicated aspect since it requires a nested aggregation.
To create the Control_Chart_Sigma calculated item, do the following:
The UCL line needs to be three sigma, or three standard deviations above the mean. Thus, we will multiple sigma by three and add the mean. To create Control_Chart_UCL, do the following:
Control Chart LCL
The LCL line needs to be three sigma, or three standard deviations below the mean. Thus, we will multiple sigma by three and subtract it from the mean. To create Control_Chart_LCL, do the following:
Now you should have a custom chart and several calculated items. Drag the custom graph onto the Visual Analytics canvas and assign roles to your date variable, Control_Chart_Measure, Control_Chart_Average, Control_Control_Chart_UCL, and Control_Chart_LCL. The final step is to add a filter for date which will ensure that the calculations are for the correct time period. To add the filter, do the following:
Now you should have a control chart in Viya Visual Analytics to monitor changes on a regular basis over a set time period.
Questions? Comments? Please feel free to leave a comment!
Hi @SophiaRowland I'm trying to replicate your Control Chart, but I didn't understood how you create your “Number_of_Days” from today. You create the variable on VA from your date variable or was on your dataset?
Thanks in advance
Hello @fj181. In this example, Number_of_Days is up to you. If you want your control chart to go back a week, you would replace Number_of_Days with 7, if you want your control chart to go back a month, you would replace Number_of_Days with 30, etc.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.