In the latest release of SAS Visual Analytics Designer, a parameter is a variable whose value can be changed and that can be referenced by other report objects. Why is this an important introduction?
This addition means that, not only can you design interactive reports via prompt controls, those controls can now map to a variable that feeds the report calculated data items or aggregated measures based on numeric or string calculations. In practice, you assign a parameter to one control in your report, and then you can use that parameter multiple times in calculations, display rules, filters or ranks, and they will be automatically updated as the value of the parameter is changed.
You can also design complex reports where the same parameter can be used in multiple custom calculations, display rules, filters or ranks. Ultimately, this is the power behind parameters. A user can select a value once, whether it is a report, section prompt or even a standalone control interaction, and the parameter by-product (calculated item, aggregated measure, filter, rank or display rule) is updated in every instance within the report.
The table below lists the supported control objects and the types of supported parameters introduced in the SAS Visual Analytics 7.1 release:
Sound complicated? Not at all! Here are two step-by-step examples that show you how to create and use parameters when designing SAS Visual Analytics reports:
Example 1: slider variable and aggregated measure
The first example shows the product material cost for product lines broken down by regions. This report allows the user to select a variable waste percentage which feeds the aggregated measure: Product Material Cost + Waste. When manufacturing products there is an excess of material, i.e. product material waste, and this report allows a user to interactively calculate the new Product Material Cost plus Waste based on a percentage variable.
Here are the steps to create this slider variable and aggregated measure example:
- Create the parameter. You can create a parameter in three places: from the Data tab’s menu, by right-clicking on the data item and from the Calculated Item or Aggregated Measure advanced editor.
Because I wanted to add the slider control to the report first and because this parameter will not be based on an existing data item, I used the Data tab’s menu option: New Parameter…. Then you can simply name the parameter, select Numeric as the type, enter a minimum, maximum and current value, and select the desired format.
Numeric parameters require a current value, which then serves as the default value. I wanted my report users to select a 1 through 100 percent value to serve as the waste percentage variable; therefore, I used the percent format to handle the percentage display.
- Next, add the slider control to the report and assign the parameter role.
- Then create the aggregated measure: Product Material Cost + Waste. I used the Sum _ByGroup_ to support any combination of grouping used in the visualizations.
- Last, test out the parameter. The slider control supports both drag-and-drop and keyed entries. To key in a specific value, simply click on the number and enter your unformatted value.
Side Note: If the control driving your parameter is not a report or section prompt, then you can see your parameter interactions from the Interactions View and selecting the Show parameter interactions check box.
Example 2: parameter driven from a button bar and custom category
The second example uses a parameter driven from a button bar using a custom category to derive an aggregated measure. I won’t walk through this example step-by-step, but here are a few pointers.
When creating a parameter that uses the data item’s values, it is easiest to right-click on the data item and select Create Parameter from Data Item…. This is even possible from custom categories, as shown in the graphic below:
When defining the measure for this example, I used the selected value from the button bar to derive an aggregated measure based on a business rule. My business rule dictated that the Projected Yield equaled the Unit Yield (actual) multiplied by a constant. That constant was a 15% increase for High Yield states, 5% increase for Medium Yield states, and 1% increase for Low Yield states. The graphics below show how you can use either the Text view or the Visual view when defining parameters. Once defined, you can use the parameter result, in this case an aggregated measure, in multiple objects.
Example 3: complex example using web data
Watch this video tutorial for an additional example of using parameters. This example was generated using SAS to extract data from web-based sources.