Working with Calculated Data Items in Reports

About Calculated Data Items

SAS Visual Analytics Designer enables you to calculate new data items from your existing data items by using an expression. For example, you might want to calculate a company’s profits by subtracting expenses from revenues.
In addition to performing mathematical calculations on numeric values, you can use calculated items to create date and time values. For example, if your data contains separate categories for month, day, and year, then you can calculate a date value from those categories.
A hierarchy can contain calculated data items.

Add a New Calculated Data Item to a Report

To add a new calculated data item:
  1. On the Data tab, click show actions button icon and then select New Calculated Item. The New Calculated Data Item window is displayed.
    New Calculated Data Item Window
    New Calculated Data Item Window
  2. Enter a Name.
  3. Select the data type for the calculated item from the Result type drop-down list. Your choices are Date, Datetime, Numeric, and Time. Numeric is the default data type.
    Calculated data items in SAS Visual Analytics Designer always default to the following formats, which are based on the data type:
    • Date: DATE10
    • Datetime: DATETIME10
    • Numeric: COMMA12.2
    • Time: TIME10
    After you create the new calculated data item, you can change its format using the data item table on the Data tab.
    SUM is the default aggregation for new numeric calculated data items in SAS Visual Analytics Designer. You can change the aggregation for numeric calculated data items using the data item table on the Data tab.
  4. Build the expression for your calculated data item by dragging data items and operators onto the expression in the right pane. For each rectangular field in the expression, you can insert a data item, an operator, or a specific value.
    When you drag items or operators onto your expression, the precise location of the cursor determines where and how the new element is added to the expression. As you drag the new element over the expression, a preview appears that displays how the expression changes if you drop the element at that location.
    For example, if your current expression is ( Profit / Revenue ), and you drag the x - y (Minus) operator over the open parenthesis symbol, then the expression changes to ( [number] — ( Profit / Revenue )). If you drag the operator over the division symbol, then the then expression changes to ( Profit — Revenue ), and so on.
    There are a large number of operator types available to perform mathematical functions, process datetime values, and evaluate logical processing such as “if” clauses. For more information about operators, see Operators for Calculated Data Items.
  5. Click OK. The new calculated data item appears in the Data tab. The calculated category icon calculated measure icon, or calculated datetime icon icons identify the new calculated data item on the Data tab.
    Note: The calculated category icon icon is displayed only if you change a calculated numeric measure to a category data item.

Editing a Calculated Data Item

To edit a calculated data item:
  1. Right-click a calculated data item on the Data tab and select Edit Calculated Item. The Edit Calculated Item window is displayed.
  2. Modify the calculated data item as needed.
  3. Click OK.
You can duplicate and remove calculated data items using the same steps as any other data items. If a calculated data item is used inside another calculated item, then it cannot be removed.