This example demonstrates how a user-written SAS code transformation template can be used in a job. This example is based on the PrintHittingStatistics template that is described in “Example: Creating a SAS Code Transformation Template” on page 122.
Preparation
Assume the following about the job in the current example:
3 A data warehouse project plan identified the need for a report that displays hitting statistics for baseball teams. The following display shows the kind of output that is desired.
Loading Targets in a Data Warehouse or Data Mart 4 Start SAS ETL Studio and Open the Appropriate Metadata Profile 151
Display 10.14 Example Hitting Report
3 The input for the report is a table that contains batting statistics for a baseball team. The columns in the source table are assumed to be similar to the columns shown in the following display.
Display 10.15 Contents of Table: TigersHitting2002
3 Metadata for the source table, a SAS dataset called TigersHitting2002, is available in a current metadata repository.
3 The report will be produced by a SAS ETL Studio job, using the
PrintHittingStatistics transformation template. The template has already been created as described in “Example: Creating a SAS Code Transformation Template” on page 122. Usage details for the template have been documented, as described in “Document Any Usage Details for the Template” on page 130.
3 Output for the report will be sent to the Output tab of the Process Designer window. The appropriate option must be set so that the Output tab appears in the Process Designer window. For details, see “Process Designer Window” on page 105.
3 The main metadata repository is under change management control. For details about change management, see “Working with Change Management in SAS ETL Studio” on page 21.
3 You have selected a default SAS application server for SAS ETL Studio, as described in “Select a Default SAS Application Server” on page 58.
Start SAS ETL Studio and Open the Appropriate Metadata Profile
Perform the following steps to begin work in SAS ETL Studio:
1 Start SAS ETL Studio as described in “Start SAS ETL Studio” on page 55.
2 Open the appropriate metadata profile as described in “Open a Metadata Profile” on page 58. For this example, the appropriate metadata profile would specify the project repository that will enable you to access the PrintHittingStatistics
transformation template and the metadata for the required source, TigersHitting2002.
152 Check Out Any Metadata That Is Needed 4 Chapter 10
Check Out Any Metadata That Is Needed
To add a source or a target to a job, the metadata for the source or target must be defined and available in the Project tree. In the current example, assume that the metadata for the relevant source must be checked out. The following steps would be required:
1 On the SAS ETL Studio desktop, select the Inventory tree.
2 In the Inventory tree, open theTablesfolder.
3 Select the source table that you want to add to the new job: TigersHitting2002.
4 Select
Project I Check Out
from the menu bar. The metadata for this table will be checked out and will appear in the Project tree.
The next task is to create and populate the job.
Create and Populate the New Job
With the relevant source checked out in the Project tree, follow these steps to create and populate a new job. To “populate a job” means to create a complete process flow diagram, from sources, through transformations, to targets.
1 From the SAS ETL Studio desktop, select Tools I Process Designer
from the menu bar. The New Job wizard is displayed.
2 Enter a name and description for the job. Type the name PrintHittingStats Job, press the Tab key, the enter the descriptionGenerates a report that prints hitting statistics for a baseball team.
3 Click Finish . An empty job will open in the Process Designer window. The job has now been created and is ready to be populated with the PrintHittingStatistics transformation template and the source table, TigersHitting2002.
4 From the SAS ETL Studio desktop, click theProcesstab to display the Process Library.
5 In the Process Library, open theUserDefinedfolder and theReportssubfolder.
6 Click, hold, and drag thePrintHittingStatisticstransformation into the empty Process Designer window. Release the mouse button to display the template in the Process Designer window for the new job, as shown in the following display.
Loading Targets in a Data Warehouse or Data Mart 4 Create and Populate the New Job 153
Display 10.16 PrintHittingStatistics Template, Unpopulated
7 From the SAS ETL Studio desktop, click theProjecttab to display the Project tree. You will see the new job and the source table that you checked out, TigersHitting2002.
8 In the Project tree, click and drag theTigersHitting2002table into the drop zone (dashed-line box) in the Process Designer window, then release the mouse button. TheTigersHitting2002table appears as a source in the new job.
9 Click and drag the Total_Sales_By_Employeetable into the output drop zone in the Process Designer window. The target replaces the drop zone and a Loader transformation appears between the target and the SQL Join transformation template, as shown in the following display.
Display 10.17 PrintHittingStatistics Template, Populated
The job now contains a complete process flow diagram, from the source through the transformation. No target is required in the process flow diagram because output for the job will be sent to the Output tab of the Process Designer window.
154 Update the Template as Necessary 4 Chapter 10