140 Example: Using the Target Table Designer to Register SAS Tables Chapter 9 Example: Using the Target Table Designer to Register SAS Tables Preparation Suppose that you wanted to create a report that shows which sales person is making the most sales, as described in “Which Salesperson Is Making the Most Sales?” on page 45. You decide to extract columns from several existing tables, write that information to a new table, and run a report on the new table. An example of this report is shown in the following display. Display 9.1 Total Sales by Employee Report One way to create a new table whose columns are extracted from existing tables is to create a job that joins the required tables and writes the output of the join to a new table. The new table would be the input to a report transformation. An example of such a process flow is shown in Display 10.3 on page 153. However, in order to create this process flow, you must first register both the source tables and the new target table. SAS Data Integration Studio needs the target table metadata to specify the content and structure of the information that is extracted from the source tables. This example describes how to use the Target Table Designer wizard to register a new table whose columns are modeled after the columns in several existing tables. Assume that the following preparations have been made: The sales report will be based on a new table that is named Total_Sales_By_Employee. This table will have the same columns in the same order as the report that is shown in Display 9.1 on page 140. Total_Sales_By_Employee will be created by a SAS Data Integration Studio job that joins two existing tables: ORDER_FACT and ORGANIZATION_DIM. Metadata for ORDER_FACT and ORGANIZATION_DIM is available in a current metadata repository. Metadata for the following columns will be imported from the ORGANIZATION_DIM table into the Total_Sales_By_Employee table: Employee_Name, Employee_ID, Job_Title, Company, Department, Section, Org_Group. These fields are needed to identify the employee in the report. Metadata for the following column will be imported from the ORDER_FACT table into the Total_Sales_By_Employee table: Total_Retail_Price. This field lists the price of each item sold by an employee. This information will be used calculate the total sales for each employee. The Total_Sales_By_Employee table will be in SAS format and will be stored in a SAS library named Report Table Lib. The Report Table Lib library has been registered in a current metadata repository. For details about libraries, see “Registering Libraries” on page 59. Registering Data Targets Select the Target Table Designer 141 The main metadata repository is under change-management control. In the current example, you must check in the metadata for the target table that you are registering. For details about change management, see “Working with Change Management” on page 113. Start SAS Data Integration Studio and Open a Metadata Profile Follow these steps to begin work in SAS Data Integration Studio: 1 Start SAS Data Integration Studio as described in “Starting SAS Data Integration Studio” on page 93. 2 Open the appropriate metadata profile as described in “Opening a Metadata Profile” on page 95. You do not need to check out a library in order to add metadata for tables in that library. Accordingly, the next task is to select the Target Table Designer. Select the Target Table Designer Follow these steps to select the Target Table Designer: 1 From the SAS Data Integration Studio menu bar, select Tools Target Designer. The Target Designer selection window displays. Display 9.2 Target Designer Selection Window 2 The list of wizards on your machine might differ from the list that is shown. Only target types for the Target Designer wizards that have been installed are available. 142 Enter a Name and Description Chapter 9 Follow these steps from this window: a Click the Target Table icon. b Click Next. Because you have set up a default SAS application server, the wizard tries to open a connection to this default server. If a valid connection to this server exists, you are prompted for a valid user name and a password. After you provide that information, the name and description window displays in the Target Table Designer. Enter a Name and Description After you have connected to a SAS application server, use the first window in the wizard to enter a name and description for the table that you want to register. Note: The metadata object might or might not have the same name as the corresponding physical table. You will specify a name for the physical table later in another window in this wizard. In this example, in the Name field, enter Total_Sales_By_Employee as the name of the metadata object. In the Description field, enter the following: Provides a total sales figure and job information for each salesperson. You can create the table by joining the source tables ORDER_FACT and ORGANIZATION_DIM. When the text is complete, click Next. The column selection window displays. Select Column Metadata from Existing Tables As noted in “Preparation” on page 140, you will import column metadata from the ORGANIZATION_DIM and ORDER_FACT tables into the metadata for the Total_Sales_By_Employee table. Follow these steps: 1 In the Available Tables pane, expand the folder for the repository that contains metadata for the ORGANIZATION_DIM and ORDER_FACT tables. 2 Expand any subfolders, such as the All Tables subfolder, to find the metadata for the tables. 3 Find the icon for the table ORGANIZATION_DIM, expand it, and select the desired columns: Employee_Name, Employee_ID, Job_Title, Company, Department, Section, Org_Group. Registering Data Targets Select Column Metadata from Existing Tables 143 4 Click the right arrow to copy the selected columns into the Selected Columns box. The column selection window will look similar to the following display. Display 9.3 Columns Selected from the ORGANIZATION_DIM Table 5 Find the icon for the table ORDER_FACT, expand it, and select the desired column: Total_Retail_Price. 6 Click the right arrow to copy the selected column into the Selected Columns list box. The column selection window will look similar to the following display. Display 9.4 Column Selected from the ORDER_FACT Table 7 When finished, click Next. The column management window displays. 144 Specify Column Metadata for the New Table Chapter 9 Specify Column Metadata for the New Table Use the column management window to accept or modify any column metadata that you selected in the previous window. You can add new columns or modify existing columns in various ways. (For details, click the Help button for the window.) In the current example, we know that a report will be generated from the target table that we are registering. We could reorder the imported columns to more closely match the columns in the report. To reorder columns, click the row number for a column and drag it to the desired place in the list. If we were to reorder the column metadata to match the draft report shown in Display 5.1 on page 45, the column management window would look similar to the following display. Display 9.5 Column Management Window When you are finished reviewing the column metadata, click Next. If you have changed the default order of the column metadata, you are prompted to save the new order. In the current example, you would select Yes to preserve the order of the columns. The physical storage window displays. . Change Management” on page 1 13. Start SAS Data Integration Studio and Open a Metadata Profile Follow these steps to begin work in SAS Data Integration Studio: 1 Start SAS Data Integration Studio as described. 10 .3 on page 1 53. However, in order to create this process flow, you must first register both the source tables and the new target table. SAS Data Integration Studio needs the target table metadata. Integration Studio as described in “Starting SAS Data Integration Studio on page 93. 2 Open the appropriate metadata profile as described in “Opening a Metadata Profile” on page 95. You do not need