Creating Data Items

What Are Data Items?

Data items are the building blocks that your end users use to build reports. You can create two types of data items:
  • Measure data items are data items whose values are aggregated by default and which can be used in computations or analytical expressions. For example, if you want a data item to calculate salary totals, you would create a measure data item from a salary column in your data source. Typically, the values for measure data items are numeric.
  • Category data items are data items whose distinct values are used to aggregate the values of measure data items. For example, if you want to aggregate your salary data by geographical location, you would create a category data item from a column that contains geographical region names.
For this scenario, you create both measure and category data items. Some of the data items are created directly from the columns that they reference, and others are based on expressions that you create.

Create Data Items from Columns

Create the Data Items

To create data items directly from the columns:
  1. In the SAS Information Map Studio main window, select the Design tab.
  2. Create five data items that will be located in the Employee Information folder:
    1. In the Information Map Contents pane, select the Employee Information folder so that the data items are created directly in that folder.
    2. In the Selected Resources pane, expand EMPINFO.
    3. Press the CTRL key and select NAME, IDNUM, JOBCODE, DEPTCODE, and LOCATION. (Make sure that EMPINFO is not selected).
    4. Click Insert to create the data items.
      Design tab with new employee information data items
      Note: The name of the data item that was created from the IDNUM column is Identification Number, which is the same as the column's label. The column label was used for the data item name because an option in the Options dialog box is set (by default) to use column labels for the data item names (when labels are available).
  3. Create four data items that will be located in the Salary Statistics folder:
    1. In the Information Map Contents pane, select the Salary Statistics folder so that the data items are created directly in that folder.
    2. In the Selected Resources pane, expand SALARY.
    3. Select the SALARY column.
    4. Click Insert four times to create four data items from the same column.
      Design tab with new salary data items
  4. Create one data item that will be located in the Seniority folder:
    1. In the Information Map Contents pane, select the Seniority folder so that the data item is created directly in that folder.
    2. In the Selected Resources pane, expand EMPINFO.
    3. Select the HDATE column.
    4. Click Insert to create the data item.
      Design tab with new Hire Date data item

Rename the Data Items

You can rename a data item if its default name does not follow a standard format or does not clearly convey its purpose.
To rename data items:
  1. In the SAS Information Map Studio main window, select the Design tab.
  2. In the Information Map Contents pane, right-click the Jobcode data item in the Employee Information folder, and then select Rename from the pop-up menu.
  3. Enter Job Code.
  4. Use the preceding steps to rename the following data items:
    Folder Name
    Original Data Item Name
    New Data Item Name
    Employee Information
    Deptcode
    Department
    Salary Statistics
    Salary
    Average Salary
    Salary Statistics
    Salary2
    Minimum Salary
    Salary Statistics
    Salary3
    Maximum Salary
    Salary Statistics
    Salary4
    Sum of Salaries
    Information Map Contents pane with renamed data items

Change the Classification

By default, the Identification Number data item was created as a measure data item because it was created from a numeric column. Because this data item is used for grouping values and should not be aggregated, you need to reclassify it as a category data item.
To change the classification for this data item:
  1. In the SAS Information Map Studio main window, select the Design tab.
  2. In the Information Map Contents pane, right-click the Identification Number data item in the Employee Information folder, and then select Properties from the pop-up menu.
  3. In the Data Item Properties dialog box, select the Classifications, Aggregations, Formats tab.
  4. In the Classifications and Aggregations section, select the Category radio button.
    Classifications, Aggregations, Formats tab with updated classification
  5. Click OK. In the Information Map Contents pane, the icon for the data item has changed to a category icon (Icon).
    Information Map Contents pane with updated data item

Change the Method of Aggregation

By default, the data items in the Salary Statistics folder were created so that end users could select from multiple methods of aggregation. You've decided to use each of the data items to produce a unique aggregation, so you are going to limit each data item to a single method of aggregation.
To change the method of aggregation for these data items:
  1. In the SAS Information Map Studio main window, select the Design tab.
  2. In the Information Map Contents pane, right-click the Average Salary data item in the Salary Statistics folder, and then select Properties from the pop-up menu.
  3. In the Data Item Properties dialog box, select the Classifications, Aggregations, Formats tab.
  4. Below the Aggregate functions list, click Clear All to deselect all of the aggregate functions.
  5. From the Aggregate functions list, select AVG(argument) to specify that you want this data item to average salary values.
    Classifications, Aggregations, Formats tab with updated method of aggregation
  6. Click OK.
  7. Use the preceding steps to change the aggregate functions for the following data items:
    Data Item Name
    Aggregate Function
    Minimum Salary
    MIN
    Maximum Salary
    MAX
    Sum of Salaries
    SUM(argument)

Change Formatting Options

You want to change the number of decimal places that are displayed for the salary data items when aggregated values are displayed in a report. To change this data item property, you decide to use the multi-edit feature of SAS Information Map Studio:
  1. In the SAS Information Map Studio main window, select the Design tab.
  2. In the Information Map Contents pane, press the CTRL key and select Average Salary, Minimum Salary, Maximum Salary, and Sum of Salaries.
  3. In the Properties pane of the main window, click DOLLAR12.0 in the Format row of the properties table.
    Properties pane
    The Data Item Properties dialog box opens.
  4. Make sure that the Selected Data Items list on the left side of the dialog box contains all four of the data items that you selected.
    Selected Data Items list in the Data Item Properties dialog box
  5. In the Formats section of the Classifications, Aggregations, Formats tab, enter 2 in the field next to Valid decimal range.
    Formats section with updated decimal-places value
  6. Click OK to update all four of the data items.

Change the Value-Generation Method

Each data item has a value-generation method that enables you to build either a static or dynamic list of values for a data item. You can use these lists in filters. By default, no list is generated for a data item. For this information map, you want to enable users to generate a dynamic list for the Location data item.
To change the value-generation method for this data item:
  1. In the SAS Information Map Studio main window, select the Design tab.
  2. In the Information Map Contents pane, right-click the Location data item in the Employee Information folder, and then select Properties from the pop-up menu.
  3. In the Data Item Properties dialog box, select the Value-Generation Method tab.
  4. On the Value-Generation Method tab, select User selects values from a dynamic list.
    Value-Generation Method section with updated value-generation method
  5. Click OK.

Create a Calculated Data Item

For this scenario, you want to create a measure data item that enables your users to calculate the number of years that an employee has been with the company. Because none of the columns provide this information, you need to create a data item with an expression that calculates the value.
To create this data item:
  1. In the SAS Information Map Studio main window, select the Design tab.
  2. In the Information Map Contents pane, select the Seniority folder so that the data item is created directly in that folder.
  3. On the toolbar, click New data item to open the Data Item Properties dialog box.
  4. In the Data item name field on the Definition tab, enter Number of Years Employed.
  5. In the Description field, enter The number of years that the employee has been employed by the company.
    Definition tab
  6. Click Edit to open the Expression Editor dialog box. This dialog box enables you to create the expression that performs the calculation.
  7. To determine the number of years that an employee has been employed by the company, subtract the hire date for the employee from today's date and then divide the difference by 365 (footnote1) .
    To create an expression that performs this calculation:
    1. In the Expression Editor dialog box, select the Functions tab.
    2. In the Categories pane on the tab, select the Date and Time folder.
    3. In the Functions pane on the tab, select TODAY() and click Add to Expression.
      Expression Editor
    4. Click Subtraction button on the operator toolbar to add the subtraction operator to the expression.
    5. Select the Data Sources tab.
    6. Expand Physical Data, and then expand EMPINFO.
    7. Select the HDATE column, and then click Add to Expression.
    8. In the Expression Text box, select TODAY() - <<EMPINFO.HDATE>>, and then click Parentheses button on the operator toolbar to enclose the expression in parentheses.
    9. Deselect the expression, and then click Division button on the operator toolbar to add the division operator to the expression.
    10. In the Expression Text box, enter 365.
    11. Click Validate Expression to check the expression for errors.
      Validated expression
    12. Click OK in the message dialog box and the Expression Editor dialog box.
  8. In the Data Item Properties dialog box, select the Classifications, Aggregations, Formats tab.
  9. In the Classifications and Aggregations section, make sure that Category is selected. You want to keep the classification of category because you do not want this data item to be aggregated. You want to use this data item to display individual values or to group other data item values.
  10. By default, the format type of this data item is Date/Time because the expression contains a date function as well as a date column. But you are calculating years of service, so you want a numeric value to be displayed. In the Formats section, select Numeric from the Format type drop-down list.
  11. Select COMMA in the Format name list.
    Classifications, Aggregations, Formats tab
  12. Click OK to create the data item.
    Information Map Contents pane with new calculated data item
FOOTNOTE 1: This calculation does not consider leap years.[return]