Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Course Notes
SAS® Data Integration Studio: Fast Track Course Notes was developed by Robert Ligtenberg and Kari
Richardson. Editing and production support was provided by the Curriculum Development and Support
Department.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of
SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product
names are trademarks of their respective companies.
Copyright © 2014 SAS Institute Inc. Cary, NC, USA. All rights reserved. Printed in the United States of
America. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior written
permission of the publisher, SAS Institute Inc.
Book code E2672, course code DIFT48, prepared date 19Sep2014. DIFT48_001
ISBN 978-1-62959-283-1
For Your Information iii
Table of Contents
Prerequisites ................................................................................................................................ xi
1.1 Exploring the Platform for SAS Business Analytics ....................................................... 1-3
1.3 Introduction to the Classroom Environment and the Course Tasks ............................... 1-57
Exercises.................................................................................................................. 1-70
Exercises.................................................................................................................. 2-28
Exercises.................................................................................................................. 3-12
Exercises.................................................................................................................. 3-53
Exercises.................................................................................................................. 4-13
Demonstration: Populating the Current and Terminated Staff Tables ....................... 5-6
Exercises.................................................................................................................. 5-49
Exercises.................................................................................................................. 7-16
Exercises.................................................................................................................. 7-81
Exercises.................................................................................................................. 7-76
8.2 Using the Extract and Summary Statistics Transformations ............................................ 8-6
Demonstration: Using the Extract and Summary Statistics Transformations ........... 8-8
Exercises.................................................................................................................. 8-21
Demonstration: Working with Transformation and Job Status Handling ............... 8-44
Exercises.................................................................................................................. 8-65
8.6 Using the Transpose, Sort, Append, Rank, and List Data Transformations ................... 8-67
Demonstration: Using the Transpose, Append, Sort, Rank, and List Data
Transformations............................................................................. 8-71
Exercises.................................................................................................................. 9-28
10.2 Using the SCD Type 2 and Lookup Transformations .................................................. 10-15
Demonstration: Using the SCD Type 2 and Lookup Transformations ................. 10-29
Exercises................................................................................................................ 10-70
10.4 Introducing the Change Data Capture Transformations (Self-Study) .......................... 10-85
Exercises.............................................................................................................. 10-115
Exercises................................................................................................................ 11-27
Demonstration: Using the Oracle Bulk Table Loader Transformation ................. 12-45
viii For Your Information
Exercises................................................................................................................ 13-17
Chapter 14 Additional Topics for SAS® Data Integration Studio Users ............ 14-1
Exercises................................................................................................................ 14-21
Demonstration: Creating SAS Stored Processes from Report Jobs ...................... 15-34
Demonstration: Reviewing Two Data Management Studio Data Jobs ................. 16-14
Course Description
This course is a five-day boot camp that presents the content of both SAS® Data Integration Studio:
Essentials and SAS® Data Integration Studio: Additional Topics. It introduces and expands the knowledge
of SAS Data Integration Studio and includes topics for registering sources and targets; creating and
working with jobs; and working with transformations. This course also includes information about
working with slowly changing dimensions, working with the Loop transformations, and defining new
transformations.
To learn more
For information about other courses in the curriculum, contact the SAS
Education Division at 1-800-333-7660, or send e-mail to training@sas.com.
You can also find this information on the web at http://support.sas.com/training/
as well as in the Training Course Catalog.
For a list of other SAS books that relate to the topics covered in this
course notes, USA customers can contact the SAS Publishing Department
at 1-800-727-3228 or send e-mail to sasbook@sas.com. Customers outside
the USA, please contact your local SAS office.
Prerequisites
Before attending this course, you should have experience with
SAS programming basics
SQL processing
the SAS macro facility.
You can gain this experience by completing the SAS® Programming 1: Essentials, SAS® SQL 1:
Essentials, and SAS® Macro Language 1: Essentials courses.
xii For Your Information
Chapter 1 Introduction
1.1 Exploring the Platform for SAS Business Analytics ................................................... 1-3
1.3 Introduction to the Classroom Environment and the Course Tasks ....................... 1-57
Exercises .............................................................................................................................. 1-70
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.1 Exploring the Platform for SAS Business Analytics 1-3
Objectives
Compare the two types of SAS installations.
Define the architecture of the platform for
SAS Business Analytics.
Introduce the SAS Platform Metadata.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-4 Chapter 1 Introduction
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.1 Exploring the Platform for SAS Business Analytics 1-5
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-6 Chapter 1 Introduction
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.1 Exploring the Platform for SAS Business Analytics 1-7
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-8 Chapter 1 Introduction
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.1 Exploring the Platform for SAS Business Analytics 1-9
SAS Folders is the root folder for the folder structure. This folder cannot be renamed, moved,
or deleted. It can contain other folders, but it cannot contain individual objects.
My Folder ( ) is a shortcut to the personal folder of the user who is currently logged on.
Products contains folders for individual SAS products. These folders contain content that is
installed along with the product. For example, some products have a set of initial jobs,
transformations, stored processes, or reports that users can modify for their own
purposes. Other products include sample content (for example, sample stored
processes) to demonstrate product capabilities. Where applicable, the content is stored
under the products folder in subfolders that indicate the release number for the
product.
During installation, the SAS Deployment Wizard enables the installer to assign
a different name to this folder. Therefore, your Products folder might have a
different name.
Shared Data is provided for you to store user-created content that is shared among multiple users.
Under this folder, you can create any number of subfolders. Each subfolder has the
appropriate permissions, to further organize this content.
You can also create additional folders under SAS Folders in which to store
shared content.
Follow these best practices when you interact with SAS folders:
Use personal folders for personal content, and use shared folders for content that multiple users need
to view.
Use folders instead of custom repositories to organize content.
Do not delete or rename the Users folder.
Do not delete or rename the home folder or personal folder of an active user.
Do not delete or rename the Products or System folders or their subfolders.
Use caution when you rename the Shared Data folder.
When you create new folders, the security administrator should set permissions.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-10 Chapter 1 Introduction
15
15
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-11
Objectives
Introduce the SAS platform applications for data
management.
Explore the SAS Data Integration Studio interface.
Explore the DataFlux Data Management Studio
interface.
18
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-12 Chapter 1 Introduction
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-13
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-14 Chapter 1 Introduction
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-15
26
26
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-16 Chapter 1 Introduction
The SAS Data Integration Studio interface is designed with features that are common to most Windows
applications.
The title bar shows the current version of SAS Data Integration Studio, as well as the name of the
current connection profile.
The menu bar provides access to drop-down menus. The list of active menu items varies according
to the current work area and the type of object that is selected. Inactive menu items are disabled or
hidden.
The toolbar provides access to shortcuts for items on the menu bar. The list of active tools varies
according to the current work area and the type of object that is selected. Inactive tools are disabled
or hidden.
The status bar displays the name of the currently selected object, the name of the default SAS
Application Server if one is selected, the login ID and metadata identity of the current user, and the
name of the current SAS Metadata Server. To select a different SAS Application Server, double-click
the name of that server to open a dialog box. If the name of the SAS Metadata Server is red, the
connection is broken. In that case, you can double-click the name of the metadata server to open a
dialog box that enables you to reconnect.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-17
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-18 Chapter 1 Introduction
The Job Editor window enables you to create, run, and troubleshoot SAS Data Integration Studio jobs.
The Diagram tab is used to build and update the process flow for a job.
The Code tab is used to review or update code for a job.
The Log tab is used to review the log for a submitted job.
The Output tab is used to review the output of a submitted job.
The Details pane is used to monitor and debug a job in the Job Editor.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-19
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-20 Chapter 1 Introduction
Some folders in the Folders tree are provided by default, such as My Folder, Products, Shared
Data, System, and User Folders.
Other folders and subfolders were added by an administrator, such as Data Mart
Development.
The DIFT Demo folder contains seven metadata objects: two library objects, four table objects,
and one job object.
Each metadata object has its own set of properties.
6. If necessary, select View Basic Properties.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-21
The Basic Properties pane displays basic information for this job object.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-22 Chapter 1 Introduction
The Basic Properties pane displays basic information for this library object.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-23
The Basic Properties pane displays basic information for this table object.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-24 Chapter 1 Introduction
The General tab displays the metadata name of the table, as well as the metadata folder location.
b. Click the Columns tab.
The Columns tab displays the column attributes of the table object. Notice that all columns in this
table are numeric.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-25
The Physical Storage tab displays the name of the physical table, the name of the library, and the
type of the table.
d. Click Cancel to close the Properties window.
11. Right-click DIFT Test Table - ORDER_ITEM and select Open.
The View Data window appears and displays the data for this table.
The functions of the View Data window are controlled by the View Data toolbar:
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-26 Chapter 1 Introduction
Positions the data with the go-to row as the first displayed data line.
Enables printing.
Displays the Columns tab in the View Data Query Options window.
Displays physical column names in the column headings.
You can display any combination of column metadata,
physical column names, and descriptions in the column headings.
Displays optional descriptions in the column headings.
Displays optional column metadata names in the column headings. This
metadata can be entered in some SAS platform applications, such as SAS
Information Map Studio.
Toggles between displaying the data with metadata formats and either
physical formats or no formats (depending on the Formats setting in the
View Data tab in the Options window.)
12. To close the View Data window, select File Close (or click ).
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-27
The metadata name of the library object is shown on the General tab. The metadata folder
location is also shown.
b. Click the Options tab.
The Options tab displays the library reference and the location of the physical path of this library.
c. Click Cancel to close the Properties window.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-28 Chapter 1 Introduction
14. Right-click DIFT Test Source Library in the Folders tree and select View LIBNAME.
The Display LIBNAME window appears.
This job joins two source tables and then loads the result into a target table. The target table is
then used as the source for the Rank transformation; the result of the ranking is loaded into a
target table and sorted; and then a report is generated based on the rankings.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-29
The Columns tab in the Details pane displays column attributes for the selected table object.
These attributes are fully editable in this tab.
Similarly, selecting any of the table objects in the process flow diagram (DIFT Test Table -
ORDERS, DIFT Test Table - ORDER_ITEM, DIFT Test Target - Order Fact Table (in diagram
twice), DIFT Test Target - Ranked Order Fact) displays a Columns tab for that table object.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-30 Chapter 1 Introduction
The full mapping functionality of the Joins Designer window is found on this Mappings tab.
Similarly, selecting any of the transformations in the process flow diagram (Join, Table Loader,
Rank, Sort, List Data) displays a Mappings tab for that transformation.
e. Click Run to execute the job.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-31
Transformations are decorated with a symbol to indicate success or failure. Transformations that
complete with errors are outlined in red.
The Status tab in the Details pane shows the completion status for each step in the job. The
overall (Job) completion status is set to the lowest step completion status.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-32 Chapter 1 Introduction
f. Double-click the first Error (for the Table Loader) in the Status column.
The Details pane shifts its focus to the Warnings and Errors tab. The error indicates that the
physical location for the target library does not exist.
Now you must discover the physical location that is specified for the library object.
g. Click the Folders tab.
h. If necessary, expand Data Mart Development DIFT Demo.
i. Click DIFT Test Target Library.
The Basic Properties pane displays the physical path location.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-33
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-34 Chapter 1 Introduction
The Status tab of the Details pane shows that the transformation completed successfully.
o. Select File Close (or click ) to close the Job Editor window.
If you made any changes when you viewed the job, the following window appears:
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-35
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-36 Chapter 1 Introduction
then tabs such as Extended Attributes and Authorization do not appear in the
Properties window for a specified object.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-37
19. Examine the Enable row count on basic properties and data viewer for tables option.
a. If the check box for this option is not selected
then the Number of Rows in the Basic Properties pane displays Row count is disabled.
Retrieving the number of rows requires system resources for most database tables. For
SAS tables, the number of rows is retrieved from the table metadata and requires very
little overhead.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-38 Chapter 1 Introduction
b. Click Test Connection to establish or test the application server connection for SAS Data
Integration Studio. An Information window appears and verifies a successful connection.
Double-clicking on this area in the status bar accesses the Default Application Server
window where a selection can be made and tested.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-39
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-40 Chapter 1 Introduction
Nodes on the Diagram tab that represent work tables are displayed in collapsed format.
If Expand is selected in the Nodes area, then work table nodes are displayed in expanded format.
This results in run-time and table statistics being collected and presented for each job.
If these options are not selected, then statistics are not collected for each job. This reduces
overhead and clutter in the SAS log.
This global setting can be overridden in any job if statistics are desired.
c. Verify that the default selection in the Layout area is Left To Right.
This results in process flow diagrams being presented horizontally, such as the following:
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-41
If Top To Bottom is selected in the Layout area, the process flow diagrams resemble the
following:
These settings are used in later chapters to automatically create join conditions in the Join
transformation, map columns across transformations, and propagate columns to work
tables during the building of process flows.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-42 Chapter 1 Introduction
The options on this tab affect how data is displayed in the View Data window.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-43
a. Verify that the default selection in the Column headers area is Show column name in column
header.
This results in column headings in the View Data window such as the following:
If Show column description in column header is selected in the Column headers area, the
column headings resemble the following:
If both Show column name in column header and Show column description in column
header are selected in the Column headers area, the column headings resemble the following:
b. Verify that the default selection in the Formats area is Apply metadata formats.
This results in data values that are displayed in the View Data window with formats stored in
metadata.
If Apply metadata formats is not selected and Apply formats is selected, then data values are
displayed with formats stored in the descriptor of SAS tables.
If both Apply formats and Apply metadata formats are not selected ,then data values are
displayed in their unformatted form. (Columns that store a date format in the descriptor of a SAS
table are displayed with a YYMMDDD10. format.)
A tool in the View Data toolbar is available to toggle the metadata formats off and on.
Toggles between displaying the data with metadata formats and either physical
formats or no formats (depending on the Formats setting in the View Data tab in the
Options window.)
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-44 Chapter 1 Introduction
b. Verify the path that is specified for the DataFlux Installation Folder field in the DataFlux Data
Management Platform Tools area.
DataFlux Installation Folder: D:\Program Files\SASHome\DataFluxDataManagementStudio\2.5
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-45
34
Metadata analysis Understand what data resources you have and extract and organize
metadata from any source anywhere throughout the enterprise.
Data profiling Execute a complete assessment of your organizations data, examining the
structure, completeness, suitability, and relationships of your information
assets.
Data quality Correct data problems, standardize data across sources, and create an
integrated view of corporate information.
Data integration Consolidate and migrate data from any data structure using extract-
transform-load (ETL) methods and extract-load-transform (ELT) methods,
as well as virtual or real-time data integration.
Data monitoring Build business rules for quality, providing a foundation for an ongoing,
highly customized data governance program.
Address standardization Standardize and verify address information for more than 240 countries
around the world.
Data enrichment Add new data elements to customer and product data to meet the needs of
your organization.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-46 Chapter 1 Introduction
Before you initiate a data warehousing project, it is important to examine the data and identify data
quality issues. This demonstration illustrates accessing, navigating, and using Data Management Studio to
create, run, and examine a simple data profile.
1. If necessary, access SAS Data Integration Studio. Use Brunos credentials.
a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Verify that the connection profile is My Server.
c. Click OK to close the Connection Profile window and to access the Log On window.
d. Type Bruno in the User ID field and Student1 in the Password field.
e. Click OK to close the Log On window.
2. In SAS Data Integration Studio, select Tools DataFlux Data Management Platform Tools
Data Management Studio.
Home tab
Navigation Content
pane pane
Data Management Studio uses a tabbed interface. The Home tab includes a navigation pane on the
left and a content pane on the right.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-47
3. Locate the main menu, the toolbar, and the navigation riser bars on the Home tab.
Riser Bars
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-48 Chapter 1 Introduction
The Data items include Collections, Data Connections, and Master Data Foundations.
Collection Set of fields identified by a name. A collection can be used as input to various
Data Management Studio functions, such as the Data Viewer or a query.
Master Data Methodology for defining the best record for a resource, such as a customer
Foundations or a product.
The content pane displays overview information for the defined data connections such as name,
description, and type.
Data Management Studio supports various types of data connections:
ODBC Connection Connection that uses the common Open Database Connectivity method.
Federation Server Connection to a Federation Server with access to the data connections
Connection managed by that server.
Custom Connection Connection string for non-ODBC connection types. Connection strings
can be used to establish native connections to third-party databases or to
draw data from more than one type of data source.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-49
The new data connection pointing to SAS data sets appears in the content pane.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-50 Chapter 1 Introduction
7. In the navigation pane, click to expand Data Connections DIFT Orion Data BASE SAS.
The content pane displays the SAS tables that are found in this data connection.
8. In the Navigation area, click the Administration riser bar.
The Administration riser bar enables you to manage various resources such as repositories, the
Quality Knowledge Base (QKB), reference sources (data packs), and macro files.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-51
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-52 Chapter 1 Introduction
c. Click OK.
The profile opens in a new tab in Data Management Studio.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-53
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-54 Chapter 1 Introduction
The content pane displays the single-valued metrics for all the columns.
c. Click the STATE column.
The Column Profiling tab displays the single-valued metrics for the selected column.
d. Click the Frequency Distribution tab.
This tab displays counts and percentages of data values in the selected column.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-55
This tab displays counts and percentages of the character patterns in the selected column.
f. In the left pane, click the CONTACTS table.
g. In the right pane, click the Visualizations tab.
1) Click to the right of the Chart field.
2) Type Visual Comparison of Metrics in the Description field.
3) Verify that the Chart type is set to Bar.
4) Verify that the Data type is set to Field metrics.
5) In the Fields pane, select the following fields:
ADDRESS
CITY
COMPANY
CONTACT
DATABASE
6) In the Metrics pane, select Maximum Length and Data Length.
The final settings should resemble the following:
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-56 Chapter 1 Introduction
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-57
Objectives
Define the classroom environment.
Define the tasks for the course scenario.
Define an initial data model to be used for the
data mart.
38
Classroom Environment
During this course, you use a classroom machine
where the SAS platform is installed and configured
in a single-machine environment.
The single-machine environment provides an easy
way for each student to learn how to interact with
the SAS platform while not impacting other students.
The classroom environment includes the following
predefined elements in the SAS metadata:
users for the various job roles
groups
metadata folders with data and report objects
a basic security model
39
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-58 Chapter 1 Introduction
Course Data
The Orion Star data used in the course consists
of the following:
data ranging from 2007 through 2011
employee information for the employees located
in many countries as well as at the United States
headquarters
approximately 5,500 different sports and outdoor
products
approximately 90,000 customers worldwide
approximately 750,000 orders
64 suppliers
41
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-59
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-60 Chapter 1 Introduction
Course Scenario
In this course, you have the opportunity to learn about
SAS Data Integration Studio as a data integration
developer.
The course includes follow-along demonstrations,
exercises to reinforce the demonstrations, and a small
case study to practice what you learned.
44
45
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-61
46
47
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-62 Chapter 1 Introduction
48
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-63
50
51
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-64 Chapter 1 Introduction
53
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-65
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-66 Chapter 1 Introduction
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-67
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-68 Chapter 1 Introduction
Star Schema
In this class, you adopt the star schema as the data
model for the data mart to be built.
Organization Customer
Dimension Dimension
Order
Fact Table
Product Time
Dimension Dimension
60
The star schema is commonly used as the data model for a data mart. The star schema consists of a fact
table that references any number of dimension tables. The fact table stores the numerical facts for
business transactions (such as the price and the quantity). The dimension tables store context information
for the facts (such as customer information, product information, and time information).
A star schema
combines the positive features of the models above
divides the data into categories that are natural to
business users (customers, products, and so on).
61
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-69
62
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-70 Chapter 1 Introduction
Exercises
These exercises illustrate aspects of the design process for the Product dimension table.
1. Listing Data Items to Address Business Questions in the Product Area
List the data items needed to answer product-related questions. Is the item used as a GROUP BY
(categorical) column or as an item on which to calculate a summary statistic (analysis)?
Below are some business analytical requirements that are to be addressed:
Which products are sold? How often, when, and where? This might include Top and Bottom X
reports.
Which products are not sold? Where and when?
How does profitability vary by product, product group, product category, and product line (sales
price versus cost price related to amounts sold)?
Do discounts raise sales (by product groups or categories, time periods, countries, sales channels)?
Does discounting yield greater profitability (by product groups or categories, time periods,
countries, sales channels)?
How does profitability vary by supplier? Can you negotiate lower cost prices or higher sales prices?
Should some suppliers be dropped? (What are the bottom X suppliers?)
Data items in the product area
Place an X in the column to indicate whether the data item is used as a GROUP BY (categorical)
column or as an item on which to calculate a summary statistic (analysis). Add any additional data
items that you think might be needed.
Product_ID
Product_Name
Product_Group
Product_Category
Product_Line
Supplier_ID
Supplier_Name
Supplier_Country
Discount
Total_Retail_Price
CostPrice_Per_Unit
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-71
The following table represents a data dictionary of the available source columns:
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-72 Chapter 1 Introduction
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-73
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-74 Chapter 1 Introduction
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-75
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-76 Chapter 1 Introduction
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-77
Product_ID
Product_Category
Product_Group
Product_Line
Product_Name
Supplier_Country
Supplier_ID
Supplier_Name
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-78 Chapter 1 Introduction
Product_Category X
Product_Group X
Product_Line X
66
Product_ID and Product_Name are also found in the PRODUCT source table.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-79
Organization Customer
Dimension Dimension
Order
Fact Table
Product Time
Dimension Dimension
68
ETL: Extract, Transform, and Load is an industry term. It is widely used to refer to a job that extracts data
from transactional sources, transforms the extracted data into business terms, and loads the results
into a data warehouse.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-80 Chapter 1 Introduction
69
70
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.3 Introduction to the Classroom Environment and the Course Tasks 1-81
71
72
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-82 Chapter 1 Introduction
Product_ID X
Product_Name X
Product_Group X
Product_Category X
Product_Line X
Supplier_ID X
Supplier_Name X
Supplier_Country X
Discount X
Total_Retail_Price X
CostPrice_Per_Unit X
Product_Category X
Product_Group X
Product_Line X
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.4 Solutions to Exercises 1-83
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-84 Chapter 1 Introduction
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
Chapter 2 Working with Change
Management
2.1 Introduction to Change Management ........................................................................... 2-3
Demonstration: Exploring the Basics of Change Management ............................................. 2-7
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.1 Introduction to Change Management 2-3
Objectives
Define the change management feature of
SAS Data Integration Studio.
Use change management to update metadata and to
create new metadata.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-4 Chapter 2 Working with Change Management
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.1 Introduction to Change Management 2-5
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-6 Chapter 2 Working with Change Management
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.1 Introduction to Change Management 2-7
This demonstration illustrates using the change management feature of SAS Data Integration Studio.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-8 Chapter 2 Working with Change Management
3. Double-click the application server area of the status bar to open the Default Application Server
window.
The Default Application Server window appears.
4. Verify that SASApp is selected as the value for the Server field.
5. Click Test Connection.
8. Verify that the tree view area now has a Checkouts tab.
This tab displays metadata objects that are checked out of the parent repository, as well as any new
objects that Kari creates.
9. If necessary, click the Folders tab.
10. Expand the Data Mart Development DIFT Demo folders.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.1 Introduction to Change Management 2-9
11. Select DIFT Test Job - OrderFact Table Plus, DIFT Test Source Library, and DIFT Test Table -
ORDER_ITEM.
12. Right-click one of the selected objects and select Check Out.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-10 Chapter 2 Working with Change Management
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.1 Introduction to Change Management 2-11
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-12 Chapter 2 Working with Change Management
8. Right-clicking DIFT Test Source Library (or DIFT Test Job - OrderFact Table Plus) shows that
the Check Out option is not available.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.1 Introduction to Change Management 2-13
Ole can see that Kari had this object checked out and that it was checked in. The title and description
information entered by Kari in the Check In Wizard can give Ole an idea about what updates Kari
made to this metadata object.
12. Select File Close to close the History window.
13. Right-click DIFT Test Table - ORDER_ITEM and select Check Out.
14. Click the Checkouts tab and verify that the table object is available for editing.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-14 Chapter 2 Working with Change Management
Clearing a project repository unlocks checked out objects. (Any changes made to these checked out
objects are not saved.) This action also deletes any new objects that might be created in the project
repository.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.1 Introduction to Change Management 2-15
6. Select both repositories. (That is, select Kari Work Repository, hold down the Ctrl key, and select
Ole Work Repository.)
7. Click OK.
8. Verify that the previously checked out objects are no longer checked out.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-16 Chapter 2 Working with Change Management
17. Select File Exit to close Oles SAS Data Integration Studio session.
18. Access Karis SAS Data Integration Studio session.
19. Click the Checkouts tab.
20. Select View Refresh. No objects appear after the refresh.
21. Click the Folders tab.
22. Select View Refresh. No objects appear as if they are checked out.
23. Select File Exit to close Karis SAS Data Integration Studio session.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.2 Establishing a Change Management Environment (Self-Study) 2-17
Objectives
Discuss steps for creating and using a project
repository.
14
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-18 Chapter 2 Working with Change Management
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.2 Establishing a Change Management Environment (Self-Study) 2-19
This demonstration illustrates the creation of a project repository for Barbara, the creation of a connection
profile, as well as the specification of permissions on the Data Mart Development folder.
1. Access SAS Management Console. Use Ahmeds credentials.
a. Select Start All Programs SAS SAS Management Console 9.4.
b. Verify that the default connection profile is My Server.
Do not click Set this connection profile as the default.
c. Click OK to close the Connection Profile window and open the Log On window.
d. Type Ahmed in the User ID field and Student1 in the Password field.
Do not click Save user ID and password in this profile.
e. Click OK to close the Log On window.
SAS Management Console appears.
2. If necessary, click the Plug-ins tab.
3. Expand Metadata Manager Active Server Project Repositories.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-20 Chapter 2 Working with Change Management
c. Click Next.
d. Type Barbara Work Repository in the Name field.
e. Click Next.
f. Specify information for the attributes of the new project repository.
1) Verify that Base is the value for the Engine field.
2) Click Browse next to the Path field.
3) Navigate to D:\SAS\Config\Lev1\SASMeta\MetadataServer\MetadataRepositories.
4) Click to create a new folder.
5) Type BarbaraWork and press Enter.
6) Verify that BarbaraWork appears in the Folder name field and click OK.
The physical storage of the project repository should resemble the following:
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.2 Establishing a Change Management Environment (Self-Study) 2-21
The Access field in this step in the Create New Project Repository Wizard has four possible
values:
Administration Specifies that only administrative users can access the repository.
To all others, the repository appears as if it were offline.
g. Click Next.
h. Review the final settings.
i. Click Finish.
A message about the repository initialization appears.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-22 Chapter 2 Working with Change Management
Adding individual users is not a best practice, but is performed here for instructional
purposes only.
f. Click OK to close the Add Users and Groups window.
g. Verify that Barbara is selected in the Users and Groups area.
h. In the Effective Permissions area, click Deny for WriteMetadata.
i. Click Deny for WriteMemberMetadata.
j. Click Grant is for CheckInMetadata.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.2 Establishing a Change Management Environment (Self-Study) 2-23
d. Click Next.
e. Type Barbaras Work Repository in the Name field.
f. Click Next.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-24 Chapter 2 Working with Change Management
j. Click Next.
k. Select Connect to a project.
l. Verify that Barbara Work Repository is selected.
m. Click Next.
n. Review the final settings.
r. Click OK.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.2 Establishing a Change Management Environment (Self-Study) 2-25
SAS Data Integration Studio appears with Barbaras credentials to access Barbaras project repository.
8. Verify that Barbara does not have direct Write Member Metadata access to the Data Mart
Development folder.
a. If necessary, click the Folders tab.
b. Right-click the Data Mart Development folder and select New Folder.
c. Type Test in the Name field.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-26 Chapter 2 Working with Change Management
9. Verify that Barbara cannot directly edit the metadata objects under the Data Mart Development folder.
a. Click the Folders tab.
b. Expand Data Mart Development DIFT Demo.
c. Right-click DIFT Test Table - ORDERS and select Properties.
The Properties window appears in Read-Only mode.
d. Click Cancel.
10. Check out DIFT Test Table - ORDERS and verify that Barbara can edit the object.
a. Right-click DIFT Test Table - ORDERS and select Check Out.
b. Click the Checkouts tab.
c. Right-click DIFT Test Table - ORDERS (on the Checkouts tab) and select Properties.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.2 Establishing a Change Management Environment (Self-Study) 2-27
b. Click Yes.
c. Right-click the Test folder and select Delete.
d. Click Yes.
12. Exit SAS Data Integration Studio by selecting File Exit.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-28 Chapter 2 Working with Change Management
Exercises
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.3 Solutions to Exercises 2-29
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-30 Chapter 2 Working with Change Management
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.3 Solutions to Exercises 2-31
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-32 Chapter 2 Working with Change Management
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
Chapter 3 Creating Metadata for
Source Data
3.1 Setting Up the Environment .......................................................................................... 3-3
Demonstration: Defining Custom Folders .............................................................................. 3-5
Demonstration: Defining Metadata for a SAS Library ............................................................ 3-9
Exercises .............................................................................................................................. 3-12
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Setting Up the Environment 3-3
Objectives
Define administrative tasks to be performed for SAS
Data Integration Studio.
Use the New Library Wizard to define a SAS library.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-4 Chapter 3 Creating Metadata for Source Data
The Folders tree also provides the hierarchical structure for the inheritance of access permissions to
metadata objects.
The Inventory tree is useful for locating metadata objects by metadata type.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Setting Up the Environment 3-5
This demonstration illustrates creating a set of custom folders in the Data Mart Development folder. The
custom folders are used to organize the metadata for a data integration project. Use an administrators
credentials to complete this step.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-6 Chapter 3 Creating Metadata for Source Data
5. Right-click the Data Mart Development folder and select New Folder.
A new folder is created and Untitled is the initial name.
6. Enter Orion Source Data as the name of the folder and press Enter.
7. Right-click the Data Mart Development folder and select New Folder.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Setting Up the Environment 3-7
8. Enter Orion Target Data as the name of the folder and then press Enter.
9. Right-click the Data Mart Development folder and select New Folder.
10. Enter Orion Jobs as the name of the folder and then press Enter.
11. Right-click the Data Mart Development folder and select New Folder.
12. Enter Orion Reports as the name of the folder and then press Enter.
The final set of folders should resemble the following:
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-8 Chapter 3 Creating Metadata for Source Data
Libraries
Library A collection of one or more SAS files that is
referenced as a unit
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Setting Up the Environment 3-9
This demonstration illustrates defining metadata for a SAS library. The tables in this library are
used as data sources for a data mart.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-10 Chapter 3 Creating Metadata for Source Data
6. Click Next.
7. Specify the name and location of the new library.
a. Enter DIFT Orion Source Tables Library in the Name field.
b. Verify that the location is set to /Data Mart Development/Orion Source Data.
If the location is incorrect, click Browse, and navigate to SAS Folders
Data Mart Development Orion Source Data.
8. Click Next.
9. Select the SAS server for the new library.
a. Select SASApp in the Available servers list box.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Setting Up the Environment 3-11
If the desired path does not exist in the Available items list box, click New. In the New
Path Specification window, click Browse next to Paths. In the Browse window, navigate
to the desired path. Click OK to close the Browse window. Click OK to close the New
Path Specification window.
12. Click Next.
The review window appears.
13. Verify that the information is correct, and then click Finish.
The new library metadata object can be found in the Checkouts tree.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-12 Chapter 3 Creating Metadata for Source Data
Exercises
For this set of exercises, use Karis credentials and project repository to create the library objects.
Always use the same spelling and case as described in the exercises. That facilitates metadata
imports later in the class because the Import Wizard recognizes existing objects by their names.
1. Defining the Folder Structure
If you did not follow along with the steps in the Defining Custom Folders demonstration, then
complete those steps first.
2. Defining the DIFT Orion Source Tables Library
If you did not follow along with the steps in the Defining Metadata for a SAS Library demonstration,
then complete those steps now.
3. Defining a Library for Additional SAS Tables
Additional SAS tables are needed for the course workshops. To access these tables, a new library
object must be registered. The specifics for the library are listed below.
Name: DIFT SAS Library
Description: Checking in new library objects of DIFT Orion Source Tables Library and
DIFT SAS Library.
The Orion Source Data folder should resemble the following:
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-13
Objectives
Introduce the Register Tables Wizard to register
metadata for data sources.
Register metadata for SAS data sets
Register metadata for Oracle tables.
Register metadata for Microsoft Access tables.
Register metadata for external files with the New
External File Wizards.
15
Source Data
SAS Data Integration Studio jobs use data tables as
inputs and outputs. The tables can be SAS tables or
tables in any database management system (DBMS) that
is supported by SAS/ACCESS software.
In this class, four different types of data sources are used:
SAS tables
Oracle tables
Microsoft Access tables
external files
16
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-14 Chapter 3 Creating Metadata for Source Data
17
ERP (Enterprise Resource Planning) refers to business management software that typically includes a
database component.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-15
This demonstration illustrates using the Register Tables Wizard to define metadata for a SAS table.
The table is used as one of the data sources for a data mart.
1. If necessary, access SAS Data Integration Studio with Karis credentials.
a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Select Karis Work Repository as the connection profile.
c. Click OK to close the Connection Profile window and open the Log On window.
d. Enter Kari in the User ID field and Student1 in the Password field.
e. Click OK to close the Log On window.
2. Click the Folders tab.
3. Expand Data Mart Development Orion Source Data.
4. Verify that the Orion Source Data folder is selected.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-16 Chapter 3 Creating Metadata for Source Data
This step is omitted from the Register Tables Wizard when you register a table through a
library because the type of table is a library property (library engine).
7. Click Next. The Select a SAS Library window appears.
8. Click next to the SAS Library field and then select DIFT Orion Source Tables Library.
9. Click Next. The Define Tables and Select Folder Location window appears.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-17
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-18 Chapter 3 Creating Metadata for Source Data
15. Right-click the PRODUCT_LIST metadata table object and select Properties.
16. Enter DIFT as a prefix to the default name.
17. Remove the description.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-19
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-20 Chapter 3 Creating Metadata for Source Data
25. Right-click the DIFT PRODUCT_LIST metadata table object and select Open.
The View Data window appears.
The filter returns four rows with Product_Level equal to 4. These represent the four product lines in
the Orion Star product hierarchy. Notice that each of these records has a missing Supplier_ID value.
32. Click to re-open the Query Options window.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-21
The filter returns 13 rows of product categories in the Orion Star product hierarchy.
35. Click to re-open the Query Options window.
36. Enter 2 in the Value field.
37. Click OK to close the Query Options window.
The filter returns 58 rows of product groups in the Orion Star product hierarchy.
38. Click to re-open the Query Options window.
39. Enter 1 in the Value field.
40. Click OK to close the Query Options window.
The filter returns the remaining rows that represent distinct products sold by Orion Star. Notice that
each of these records has a valid (nonmissing) Supplier_ID value.
41. Select File Close to close the View Data window.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-22 Chapter 3 Creating Metadata for Source Data
20
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-23
This demonstration illustrates defining metadata for two tables in an Oracle database. Metadata for an
Oracle data source requires a database server definition in metadata that points to the Oracle instance.
The following steps are needed:
Verify that a database server definition exists in metadata for an Oracle database.
Define a metadata library object that uses the Oracle engine and references the Oracle database server
object.
Define metadata table objects that use the metadata library object.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-24 Chapter 3 Creating Metadata for Source Data
The Connection Properties window for the DIFT Oracle Server appears.
a. Click the Options tab.
b. Verify that the Oracle Path Information specifies a path of ora11g.
c. Verify that the Authentication type field is set to User/Password.
d. Verify that the Authentication domain field is set to OracleAuth.
The Oracle user ID and password are stored in the OracleAuth authentication domain.
e. Click Cancel to close the Connection: DIFT Oracle Server Properties window.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-25
6. Click the User Manager plug-in on the Plug-ins tab in SAS Management Console.
7. Right-click the Data Integrators group in the right pane and select Properties. The Data Integrators
Properties appears.
8. Click the Members tab.
The Data Integrators group has six members, including Kari and Bruno.
9. Click the Accounts tab.
The Data Integrators group has an Oracle account. The Oracle credentials are stored in the
OracleAuth authentication domain. An authentication domain stores the credentials to access
a server or a DBMS.
10. Click Cancel to close the Data Integrators Properties window.
11. Select File Exit to close SAS Management Console.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-26 Chapter 3 Creating Metadata for Source Data
7. Click Next.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-27
17. Click Finish. This completes the metadata definition for the library object.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-28 Chapter 3 Creating Metadata for Source Data
9. Click Next.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-29
10. Click the ORDERS table, press the Ctrl key, and click the ORDER_ITEM table.
11. Verify that the metadata location for the metadata table objects is /Data Mart Development
/Orion Source Data.
14. Right-click the ORDER_ITEM metadata table object and select Properties.
15. Enter DIFT ORDER_ITEM in the Name field.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-30 Chapter 3 Creating Metadata for Source Data
16. Click the Columns tab to view the registered column properties.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-31
19. Right-click the DIFT ORDER_ITEM metadata table object and select Open.
The View Data window appears.
23. Click the Columns tab to view the registered column properties.
The SAS datetime20. informat and format were assigned to the Oracle date-type columns. Oracle
stores dates as date-time values.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-32 Chapter 3 Creating Metadata for Source Data
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-33
23
The ODBC engine can be used if the bitness of SAS matches the bitness of the ODBC driver (for
example, 64-bit SAS and the 64-bit Microsoft ODBC drivers).
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-34 Chapter 3 Creating Metadata for Source Data
25
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-35
This demonstration illustrates defining metadata for a Microsoft Access database table. You use ODBC in
an environment where SAS and Microsoft Access share the same bitness. The classroom environment has
64-bit SAS and 64-bit ODBC drivers for Microsoft Access.
In the classroom image, this is the ODBC Data Source Administrator for 64-bit drivers. It
can also be accessed by double clicking C:\Windows\System32\odbcad32.exe.
2. Verify the pre-defined System DSNs.
a. Click the System DSN tab.
b. On the System DSN tab, select the Orion Star Contacts data source.
c. Click Configure to open the ODBC Microsoft Access Setup window.
Configure
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-36 Chapter 3 Creating Metadata for Source Data
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-37
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-38 Chapter 3 Creating Metadata for Source Data
d. Click Cancel to close the Connection: Orion Star Orders Properties window.
7. Select File Exit to close SAS Management Console.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-39
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-40 Chapter 3 Creating Metadata for Source Data
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-41
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-42 Chapter 3 Creating Metadata for Source Data
30. Click the Columns tab to view the registered column properties.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-43
33. Right-click the DIFT Customer Types metadata table object and select Open.
The View Data window appears.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-44 Chapter 3 Creating Metadata for Source Data
27
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-45
This demonstration illustrates registering metadata for a comma-delimited external file that contains
supplier information.
1. If necessary, access SAS Data Integration Studio with Karis credentials.
a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Select Karis Work Repository as the connection profile.
c. Click OK to close the Connection Profile window and open the Log On window.
d. Enter Kari in the User ID field and Student1 in the Password field.
e. Click OK to close the Log On window.
2. Click the Folders tab.
3. Expand Data Mart Development Orion Source Data.
4. Verify that the Orion Source Data folder is selected.
5. Select File New External File Delimited. The New Delimited External File Wizard appears.
6. Enter DIFT Supplier Information in the Name field.
7. Verify that the location is set to /Data Mart Development/Orion Source Data.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-46 Chapter 3 Creating Metadata for Source Data
The preview shows that the first record contains column names and that the fields are comma
delimited and not space delimited.
15. Click OK to close the Preview File window.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-47
The final settings for the External File Location window are shown here:
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-48 Chapter 3 Creating Metadata for Source Data
21. Click Auto Fill in the top portion of the Column Definitions window. The Auto Fill Columns window
appears.
22. Enter 2 in the Start record field in the Guessing records area.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-49
25. Click Get the column names from column headings in this file.
26. Verify that 1 is entered in the The column headings are in file record field.
27. Click OK. The Name fields are populated with the column names.
Supplier_ID Supplier ID
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-50 Chapter 3 Creating Metadata for Source Data
30. Click the Data tab in the bottom pane of the Column Definitions window.
31. Click Refresh.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-51
5. Click Next.
6. Verify that all objects are selected.
7. Click Next.
8. Review the information in the Summary window.
9. Click Finish.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-52 Chapter 3 Creating Metadata for Source Data
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-53
Exercises
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-54 Chapter 3 Creating Metadata for Source Data
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.3 Solutions to Exercises 3-55
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-56 Chapter 3 Creating Metadata for Source Data
8) Verify that the new path appears in the Selected items list box.
9) Click Next.
g. Verify that the information is correct in the review window.
h. Click Finish.
The new library metadata object is found in the Checkouts tree.
4) Click Next.
b. Verify that both library objects are selected.
1) Click Next.
2) Review the information in the Summary window.
c. Click Finish.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.3 Solutions to Exercises 3-57
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-58 Chapter 3 Creating Metadata for Source Data
c. Register the tables (SAS tables) that are found in the DIFT SAS Library.
1) Click the Folders tab.
2) Expand Data Mart Development Orion Source Data.
3) Verify that the Orion Source Data folder is selected.
4) Select File Register Tables. The Register Tables Wizard appears.
5) Click SAS as the type of table.
6) Click Next. The Select a SAS Library window appears.
7) Click next to the SAS Library field and then click DIFT SAS Library.
8) Click Next. The Define Tables and Select Folder Location window appears.
9) Hold down the Ctrl key and click NEWORDERTRANS, PROFIT, STAFF_PARTIAL, and
VALIDPRODUSAOUTDOOR.
10) Verify that the location is set to /Data Mart Development/Orion Source Data.
11) Click Next. The review window appears.
12) Verify that the information is correct and click Finish.
The metadata objects for the table are found in the Checkouts tree.
d. Update the properties of the new table objects.
1) If necessary, click the Checkouts tab.
2) Right-click the NEWORDERTRANS metadata table object and select Properties.
3) Enter DIFT at the beginning of the default name.
4) Remove the default description.
5) Click OK to close the Properties window.
6) Right-click the PROFIT metadata table object and select Properties.
7) Enter DIFT at the beginning of the default name.
8) Remove the default description.
9) Click OK to close the Properties window.
10) Right-click the STAFF_PARTIAL metadata table object and select Properties.
11) Enter DIFT at the beginning of the default name.
12) Click OK to close the Properties window.
13) Right-click the VALIDPRODUSAOUTDOOR metadata table object and select
Properties.
14) Enter DIFT at the beginning of the default name.
15) Remove the default description.
16) Click OK to close the Properties window.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.3 Solutions to Exercises 3-59
The metadata objects for the tables are found in the Checkouts tree.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-60 Chapter 3 Creating Metadata for Source Data
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.3 Solutions to Exercises 3-61
h. Click Yes. Review the data values on the Data tab. (The values for Sales and Cost are missing in
the first 120 rows.)
i. Click Next.
j. If the warning window appears again, click Yes.
The review window displays general information for the external file.
k. Click Finish. The metadata object for the external file is found in the Checkouts tree.
l. Check in the external file metadata object.
1) Select Check Outs Check In All.
2) Enter Adding metadata for Profit Information external file in the Title field.
3) Click Next. Verify that the external file object is selected.
4) Click Next. Review the information in the Summary window.
5) Click Finish. The external file object should no longer be in the Checkouts tree.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-62 Chapter 3 Creating Metadata for Source Data
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.3 Solutions to Exercises 3-63
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-64 Chapter 3 Creating Metadata for Source Data
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
Chapter 4 Creating Metadata for
Target Data
4.1 Registering Target Data Metadata ................................................................................. 4-3
Demonstration: Defining the Product Dimension Table Metadata ......................................... 4-6
Exercises .............................................................................................................................. 4-13
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.1 Registering Target Data Metadata 4-3
Objectives
Review features of the New Table Wizard.
Use the New Table Wizard to register metadata for
target tables.
When you define a new table, the New Table Wizard can
perform these tasks:
import metadata from tables and columns that are
already registered in the metadata repository
override metadata that was imported (for example,
change a column name)
define new attributes for the table that is defined
(for example, indexes)
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-4 Chapter 4 Creating Metadata for Target Data
Organization Customer
Dimension Dimension
Order
Fact Table
Product Time
Dimension Dimension
5 ...
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.1 Registering Target Data Metadata 4-5
The target table has columns that exist in the source tables as well as columns that do not exist in the
source tables.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-6 Chapter 4 Creating Metadata for Target Data
This demonstration illustrates using the New Table Wizard to define metadata for a target table. The target
table is a SAS data set named DIFT Product Dimension and is stored in a location described by the
DIFT Orion Target Tables Library, a new library object. (The library object is created as well.)
1. If necessary, access SAS Data Integration Studio with Karis credentials.
a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Select Karis Work Repository as the connection profile.
c. Click OK to close the Connection Profile window and open the Log On window.
d. Enter Kari in the User ID field and Student1 in the Password field.
e. Click OK to close the Log On window.
2. Click the Folders tab.
3. Expand Data Mart Development Orion Target Data.
4. Verify that the Orion Target Data folder is selected.
8. Click Next.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.1 Registering Target Data Metadata 4-7
c. Click Next.
d. Double-click SASApp in the Available servers list box to move it to the Selected servers list
box.
e. Click Next.
f. Specify the needed library properties.
1) Enter difttgt in the Libref field.
2) Click New in the Path Specification area.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-8 Chapter 4 Creating Metadata for Target Data
g. Click Next.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.1 Registering Target Data Metadata 4-9
h. Verify that the information is correct Click Finish to close the New Library Wizard and return to
the New Table Wizard.
12. Verify that the new library DIFT Orion Target Tables Library is selected in the Library field.
13. Type ProdDim as the value for the Name field.
17. Select Product_ID, Product_Name, and Supplier_ID from DIFT PRODUCT_LIST. Click
to move the columns to the Selected list box.
19. Select Country and Supplier_Name from DIFT Supplier Information. Click to move the
columns to the Selected pane.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-10 Chapter 4 Creating Metadata for Target Data
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.1 Registering Target Data Metadata 4-11
24. Define two simple indexes: one for Product_ID and one for Product_Group.
a. Click Define Indexes. The Define Indexes window appears.
b. Click New to add the first index.
c. Enter an index name of Product_ID and press Enter.
Be sure to press Enter. If you do not, the name of the index is not saved.
d. Select the Product_ID column and move it to the Indexes pane by clicking .
e. Click New to add the second index.
f. Enter an index name of Product_Group and press Enter.
g. Select the Product_Group column and move it to the Indexes pane by clicking .
The two requested indexes are defined in the Define Indexes window.
A simple index in a SAS table must have the same name as its column. A
warning dialog box is presented if an index name does not match its column
name. Clicking Yes in the dialog box enables SAS Data Integration Studio to
match
the index name to its column name.
h. Click OK to close the Define Indexes window and return to the New Table Wizard.
25. Click Next.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-12 Chapter 4 Creating Metadata for Target Data
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.1 Registering Target Data Metadata 4-13
Exercises
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-14 Chapter 4 Creating Metadata for Target Data
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.2 Importing Metadata 4-15
Objectives
Discuss exporting and importing metadata.
Discuss the SAS package format and the Common
Warehouse Metamodel format.
Use the Metadata Importer to import table metadata
from an Oracle modeling application.
14
15
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-16 Chapter 4 Creating Metadata for Target Data
16
17
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.2 Importing Metadata 4-17
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-18 Chapter 4 Creating Metadata for Target Data
This demonstration illustrates importing metadata that was exported from an Oracle modeling application
in CWM format. Write-metadata permission for the target folder is necessary. Therefore, Kari cannot
perform the steps below.
1. If necessary, access SAS Data Integration Studio with Brunos credentials.
a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Select My Server as the connection profile.
c. Click OK to close the Connection Profile window and open the Log On window.
d. Enter Bruno in the User ID field and Student1 in the Password field.
e. Click OK to close the Log On window.
2. Click the Folders tab.
3. Expand Data Mart Development Orion Target Data.
4. Verify that the Orion Target Data folder is selected.
5. Select File Import Metadata.
The Metadata Import Wizard appears. The Select an import format window lists the available
metadata bridges.
6. Click Oracle Warehouse Builder (OWB) (via CWM XMI) as the import format.
The SAS Data Integration Server license (2014) includes a choice of three metadata bridges.
7. Click Next.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.2 Importing Metadata 4-19
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-20 Chapter 4 Creating Metadata for Target Data
18. Click Finish. The metadata is imported to the SAS metadata environment.
An information window appears.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.2 Importing Metadata 4-21
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-22 Chapter 4 Creating Metadata for Target Data
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.2 Importing Metadata 4-23
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-24 Chapter 4 Creating Metadata for Target Data
2) Click . (All columns from the selected table are moved to the Selected pane.)
3) Select the DIFT ORDERS table object.
4) Click to move all columns from the selected table to the Selected pane.
An Error window appears and indicates that Order_ID cannot be added twice.
5) Click OK.
6) Click Next.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.3 Solutions to Exercises 4-25
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-26 Chapter 4 Creating Metadata for Target Data
14) Select the DIFT Order Fact table object. Click to move all columns to the Selected
pane.
15) Click Next.
16) Accept the default attributes of the columns and then click Next.
17) Review the metadata listed in the summary window.
18) Click Finish. The new table object appears on the Checkouts tab.
b. Define metadata for the DIFT Recent Orders table.
1) Click the Folders tab.
2) Expand Data Mart Development Orion Target Data.
3) Verify that the Orion Target Data folder is selected.
4) Select File New Table. The New Table Wizard appears.
5) Enter DIFT Recent Orders in the Name field.
6) Verify that the location is set to /Data Mart Development/Orion Target Data.
7) Click Next.
8) Verify that the DBMS field is set to SAS.
9) Select DIFT Orion Target Tables Library as the value for the Library field.
10) Enter Recent_Orders in the Name field.
11) Click Next.
12) Expand the Data Mart Development Orion Target Data folder on the Folders tab.
13) From the Orion Target Data folder, locate the DIFT Order Fact table object.
14) Select the DIFT Order Fact table object. Click to move all columns to the Selected
pane.
15) Click Next.
16) Accept the default attributes of the columns and then click Next.
17) Review the metadata listed in the summary window.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.3 Solutions to Exercises 4-27
18) Click Finish. The new table object appears in the Checkouts tree.
c. Define metadata for the DIFT US Suppliers table.
1) Click the Folders tab.
2) Expand Data Mart Development Orion Target Data.
3) Verify that the Orion Target Data folder is selected.
4) Select File New Table. The New Table Wizard appears.
5) Enter DIFT US Suppliers in the Name field.
6) Verify that the location is set to /Data Mart Development/Orion Target Data.
7) Click Next.
8) Verify that the DBMS field is set to SAS.
9) Select DIFT Orion Target Tables Library as the value for the Library field.
10) Enter US_Suppliers in the Name field.
11) Click Next.
12) Expand the Data Mart Development Orion Source Data folder on the Folders tab.
13) In the Orion Source Data folder, locate the DIFT Supplier Information table object.
14) Select the DIFT Supplier Information table object. Click to move all columns to the
Selected pane.
15) Click Next.
16) Accept the default attributes of the columns and then click Next.
17) Review the metadata listed in the summary window.
18) Click Finish. The new table object appears in the Checkouts tree.
d. Check in the newly created table objects.
1) Click the Checkouts tab.
2) Select Check Outs Check In All.
3) Enter Adding metadata for various target table objects in the Title field.
4) Enter Adding metadata for Old and Recent Orders, and US Suppliers in the Description
field.
5) Click Next. Verify that all table objects are selected.
6) Click Next. Review the information in the Summary window.
7) Click Finish. The table objects should no longer be on the Checkouts tab.
e. Verify the results.
1) Click the Folders tab.
2) Expand Data Mart Development Orion Target Data.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-28 Chapter 4 Creating Metadata for Target Data
3) The metadata in the Orion Target Data folder should now resemble the following:
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
Chapter 5 Creating Metadata for
Jobs
5.1 Introduction to Jobs and the Job Editor ...................................................................... 5-3
Demonstration: Populating the Current and Terminated Staff Tables .................................... 5-6
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.1 Introduction to Jobs and the Job Editor 5-3
Objectives
Define a job object.
Create and run a simple job.
Discuss features of jobs and the Job Editor window.
Overview
At this point, metadata is defined for the following:
various types of source tables
desired target tables
The next step is to define processes that
read data from the sources
perform necessary data transformations
load data into the targets in the data mart.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-4 Chapter 5 Creating Metadata for Jobs
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.1 Introduction to Jobs and the Job Editor 5-5
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-6 Chapter 5 Creating Metadata for Jobs
This demonstration shows the building of a job that uses the Splitter transformation.
The final process flow diagram resembles the following:
8. Click OK.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.1 Introduction to Jobs and the Job Editor 5-7
When a job window is active, objects can also be added to the diagram by right-clicking
and selecting Add to Diagram.
10. Select File Save to save the diagram and job metadata to this point.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-8 Chapter 5 Creating Metadata for Jobs
d. Drag the Splitter transformation to the Diagram tab of the Job Editor.
e. Position the Splitter transformation next to the source table object.
The Splitter transformation, by default, produces two work tables. (More can be produced
by specifying the properties of the Splitter transformation.) Notice that the two work table
objects are represented by the green icons located to the right of the Splitter transformation.
12. Select File Save to save the diagram and job metadata to this point.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.1 Introduction to Jobs and the Job Editor 5-9
b. Place the cursor over the connection selector. The cursor changes to a pencil.
c. With the cursor over the connection selector (and the pencil cursor visible), click the connection
selector and drag it to the Splitter transformation. Release the cursor when it is over the Splitter
transformation.
14. Select File Save to save the diagram and job metadata to this point.
15. Add the target table objects to the diagram.
a. Click the Folders tab.
b. If necessary, expand the Data Mart Development Orion Target Data folder.
c. Hold down the Ctrl key and click on the two target table objects (DIFT Current Staff
and DIFT Terminated Staff).
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-10 Chapter 5 Creating Metadata for Jobs
d. Drag the two objects to the Diagram tab of the Job Editor.
16. Select File Save to save the diagram and job metadata to this point.
17. Connect the Splitter transformation to the target table objects.
The two target tables are loaded with direct one-to-one column mappings of subsetted data and
no additional load specifications. Therefore, no Table Loader transformation is needed for either
of the target tables. Hence, the two work table objects must be deleted in order to connect the
transformation directly to the target table objects.
a. Right-click one of the work table objects of the Splitter transformation and select Delete.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.1 Introduction to Jobs and the Job Editor 5-11
b. Right-click the second work table object of the Splitter transformation and select Delete.
All work tables are now removed from the Splitter transformation.
c. Place the cursor over the Splitter transformation to reveal the connection selector
until the cursor changes to a pencil.
d. When the pencil cursor appears, click and drag it to the first output table, DIFT Current Staff.
e. Place the cursor over the Splitter transformation until it changes to a pencil. Click it and drag it
to the second output table, DIFT Terminated Staff.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-12 Chapter 5 Creating Metadata for Jobs
18. Select File Save to save the diagram and job metadata to this point.
19. Specify the properties of the Splitter transformation.
a. Right-click the Splitter transformation and select Properties.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.1 Introduction to Jobs and the Job Editor 5-13
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-14 Chapter 5 Creating Metadata for Jobs
d. Specify the subsetting criteria for the DIFT Terminated Staff table object.
1) Verify that the DIFT Terminated Staff table object is selected in the Target Tables pane.
2) Select Row Selection Conditions in the Row Selection Type field.
3) Click Subset Data below the Selection Conditions area. The Expression Builder window
appears.
4) Click the Data Sources tab.
5) Expand the STAFF table.
6) Select the Emp_Term_Date column.
7) Click Add to Expression.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.1 Introduction to Jobs and the Job Editor 5-15
A column mapping indicates that data passes from the source column to the target column.
g. Click OK to close the Splitter Properties window.
20. Select File Save to save the diagram and job metadata to this point.
21. Run the job.
a. Click Run in the job toolbar.
A job can also be processed by selecting Actions Run or by right-clicking in the job
background and selecting Run from the context menu.
b. Click the Status tab on the Details pane.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-16 Chapter 5 Creating Metadata for Jobs
c. Verify that the status for the pre-processing code, the transformation, the post-processing code,
and the overall job is Completed successfully.
25. Scroll to view the note about the creation of the DIFTTGT.TERM_STAFF table.
26. View the data for the DIFT Current Staff table object.
a. Click the Diagram tab in the Job Editor.
b. Right-click the DIFT Current Staff table object and select Open.
c. Scroll right to the EMP_TERM_DATE column. All EMP_TERM_DATE values are missing.
d. After you view the data, select File Close to close the View Data window.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.1 Introduction to Jobs and the Job Editor 5-17
27. View the data for the DIFT Terminated Staff table object.
a. Right-click the DIFT Terminated Staff table object and select Open.
b. Scroll right to the EMP_TERM_DATE column. All EMP_TERM_DATE values are
non-missing.
c. After you view the data, select File Close to close the View Data window.
28. Select File Close to close the Job Editor. If necessary, save changes to the job. The new job object
appears on the Checkouts tab.
29. Check in all objects.
a. If necessary, click the Checkouts tab.
b. Select Check Outs Check In All.
c. Enter Adding job that populates current & terminated staff tables in the Title field.
d. Click Next. Verify that the job object is selected.
e. Click Next. Review the information in the Summary window.
f. Click Finish. The job object should no longer be on the Checkouts tab.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-18 Chapter 5 Creating Metadata for Jobs
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.1 Introduction to Jobs and the Job Editor 5-19
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-20 Chapter 5 Creating Metadata for Jobs
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.1 Introduction to Jobs and the Job Editor 5-21
Introduction to Transformations
A transformation
is a metadata object
specifies how to extract data from a source, transform
data, or load data into a target
generates or retrieves SAS code
can be augmented with user-written code
can be replaced with user-written code.
17
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-22 Chapter 5 Creating Metadata for Jobs
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-23
Objectives
Discuss components of the Join transformations
Designer window.
Use the Join transformation in a job.
22
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-24 Chapter 5 Creating Metadata for Jobs
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-25
The Diagram tab appears in the main area of the Designer window when Join is selected in the Navigate
pane. The Diagram tab enables you to visually design the needed clauses for your SQL query.
The Tables pane appears when a table object is selected in the Navigate pane or when Select is selected in
the Navigate pane. The Tables pane might also open when other aspects of particular joins are requested
(for example, the surfacing of Having, Group by, and Order by information).
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-26 Chapter 5 Creating Metadata for Jobs
The Select tab appears in the main area of the Designer window when Select is selected in the Navigate
pane. The Select tab enables you to maintain the mappings from the sources to the target. The Select tab
can also be used to specify calculated columns for the target table.
The Where tab appears in the main area of the Designer window when Where is selected in the Navigate
pane (if a WHERE clause is specified as part of the SQL query). The Where tab enables you to specify the
needed subsetting or join criteria for the SQL query.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-27
Calculated Columns
Three columns for the target table must be calculated:
Product_Group
Product_Category
Product_Line
They can be derived from the Product_ID.
Product_ID: 2 1 0 1 0 0 1 0 0 0 0 1
Product_Group
Product_Category
Product_Line
A user-defined format, PRODUCT., returns the description
for each product group, -category, and -line.
31
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-28 Chapter 5 Creating Metadata for Jobs
Replacing the last five digits in Product_ID with zeros returns Product_Group from the format.
Replacing the last eight digits in Product_ID with zeros returns Product_Category from the format.
Replacing the last 10 digits in Product_ID with zeros returns Product_Line from the format.
Product_Category:
put(int(product_id/100000000)*100000000,product.)
Product_Line:
put(int(product_id/10000000000)*10000000000,product.)
33
Division and the INT function truncate the last five, eight, or 10 digits from Product_ID. Then
multiplication adds five, eight, or 10 zeros back to the truncated value. Finally, the PUT function
applies the PRODUCT. format (user-defined) to return the description of the Product_Group,
Product_Category, or Product_Line.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-29
Simplified Expressions
The expressions can be simplified with E notation as
follows:
Product_Group:
put(int(product_id/1e5)*1e5,product.)
Product_Category:
put(int(product_id/1e8)*1e8,product.)
Product_Line:
put(int(product_id/1e10)*1e10,product.)
34
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-30 Chapter 5 Creating Metadata for Jobs
This demonstration illustrates creating the job that loads the DIFT Product Dimension target table. The
job uses the Join transformation to join the DIFT Product_List and DIFT Supplier Information source
tables. In addition, three calculated columns are defined in the Join.
The final process flow diagram resembles the following:
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-31
7. Select File Save to save the diagram and job metadata to this point.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-32 Chapter 5 Creating Metadata for Jobs
d. Drag the File Reader transformation to the Diagram tab of the Job Editor.
e. Position the File Reader transformation so that it is next to (to the right of) the external file
object, DIFT Supplier Information.
9. Rename the work table object associated with the File Reader transformation.
a. Right-click the (green) work table object and select Properties.
b. Click the Physical Storage tab.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-33
Replacing the name with FileReader makes this table easier to recognize when you configure the
next transformation in the process flow.
d. Click OK to close the File Reader Properties window.
10. Select File Save to save the diagram and job metadata to this point.
11. Add the Join transformation to the diagram.
a. In the tree view, click the Transformations tab.
b. Expand the SQL grouping.
c. Click the Join transformation.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-34 Chapter 5 Creating Metadata for Jobs
d. Drag the Join transformation to the Diagram tab of the Job Editor.
e. Position the Join transformation so that it is centered with respect to the
DIFT PRODUCT_LIST table object and the File Reader transformation.
12. Select File Save to save the diagram and job metadata to this point.
13. Add inputs to the Join transformation.
a. Place the cursor over the Join transformation in the diagram to reveal the two input ports.
b. Connect the DIFT PRODUCT_LIST table object to one of the input ports of the Join
transformation.
c. Connect the File Reader transformation to the other input port of the Join transformation. (Click
on the work table icon, , associated with the File Reader transformation and drag it to the
second input port of the Join transformation.)
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-35
14. Select File Save to save the diagram and job metadata to this point.
15. Add the DIFT Product Dimension table object as the output of the Join transformation.
a. Right-click the work table of the Join transformation and select Replace.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-36 Chapter 5 Creating Metadata for Jobs
e. Click OK.
The process flow diagram is updated to the following:
16. Select File Save to save the diagram and job metadata to this point.
17. Review the properties of the File Reader transformation.
a. Right-click the File Reader transformation and select Properties.
b. Click the Mappings tab.
c. Verify that all target columns have a column mapping.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-37
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-38 Chapter 5 Creating Metadata for Jobs
The type of join can also be verified and changed by right-clicking on the Join
item in the Navigate pane. A pop-up menu displays a list of available join types
with a check mark next to the currently selected type.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-39
d. Click the Where item in the Navigate pane to surface the Where tab in the main pane.
e. Verify that the inner join is executed based on the values of the Supplier_ID columns from the
sources being equal.
Outer joins (left, right, full) do not use the Where item for the join condition. To set
conditions for an outer join, click the Join item ( ) in the Navigate pane.
f. Add an additional WHERE clause to subset the data.
1) Click New in the top portion of the Where tab.
A row is added with the logical AND as the Boolean operator.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-40 Chapter 5 Creating Metadata for Jobs
2) Select Choose column(s) from the drop-down list under the first Operand field.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-41
g. Click the Select item in the Navigate pane to surface the Select tab.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-42 Chapter 5 Creating Metadata for Jobs
i. Click to expand the Target table area. This provides more room to work with the expressions.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-43
10) Click OK to close the Properties window for DIFT Product Dimension.
11) Right-click the job DIFT Populate Product Dimension Table and select Open.
12) Right-click the Join transformation and select Open.
13) Click the Select keyword in the Navigate pane.
14) Click to expand the Target table area.
k. Specify an expression for Product_Group.
1) Locate the Product_Group column.
2) In the Expression column, select Advanced from the drop-down list.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-44 Chapter 5 Creating Metadata for Jobs
7) Click No.
8) Click OK to close the Expression window.
l. Specify an expression for Product_Category.
Text can be entered directly into the Expression field.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-45
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-46 Chapter 5 Creating Metadata for Jobs
3) From the tool bar for the Select tab, select Update Mappings to Match Columns
Used in Expression.
4) Click the column Product_Category.
5) From the tool bar for the Select tab, select Update Mappings to Match Columns
Used in Expression.
6) Click the column Product_Line.
7) From the tool bar for the Select tab, select Update Mappings to Match Columns
Used in Expression.
8) Verify that each of the calculated columns now has a mapping from the source column
Product_ID.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-47
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-48 Chapter 5 Creating Metadata for Jobs
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-49
Exercises
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-50 Chapter 5 Creating Metadata for Jobs
The icon in the upper right corners of the metadata table objects indicates
that these are Oracle tables.
f. Select File Save to save the diagram and job metadata to this point.
g. Add the Join transformation to the diagram.
1) In the tree view, click the Transformations tab.
2) Expand the SQL grouping.
3) Select the Join transformation.
4) Drag the Join transformation to the diagram.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.3 Solutions to Exercises 5-51
5) Place the Join transformation to the right of the source table objects.
i. Select File Save to save the diagram and job metadata to this point.
j. Add a target table to the diagram.
1) Right-click on the work table for the Join transformation and select Replace.
2) Verify that the Folders tab is selected.
3) Expand the Data Mart Development Orion Target Data folder.
4) Select DIFT Order Fact.
5) Click OK.
The job flow diagram is updated to the following:
k. Select File Save to save the diagram and job metadata to this point.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-52 Chapter 5 Creating Metadata for Jobs
3) In the Join Properties pane, verify that the join is an inner join.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.3 Solutions to Exercises 5-53
a) Click next to the Target table name to expand the target side.
f) Click to collapse the target table attributes back to the right side.
g) Right-click the OrderDate column.
h) Select Fix Warning Update Mappings to Match Columns Used in Expression.
i) Right-click the DeliveryDate column.
j) Select Fix Warning Update Mappings to Match Columns Used in Expression.
10) Verify that all 12 columns are now mapped.
11) Click Up to return to the Job Editor.
m. Select File Save to save the diagram and job metadata to this point.
n. Run the job.
1) Click Run.
2) Click the Status tab in the Details pane. Verify that the job completed successfully.
3) Click the Log tab and verify that DIFTTGT.ORDERFACT is created with 951,669
observation and 12 variables.
4) Click the Diagram tab.
5) Right-click DIFT Order Fact and select Open.
6) Review the data and then select File Close to close the View Data window.
7) Select File Close to close the Job Editor.
o. Check in the job.
1) Click the Checkouts tab in the tree view.
2) Select Check Outs Check In All.
3) Enter Adding job that populates order fact table in the Title field.
4) Click Next. Verify that the job object is selected.
5) Click Next. Review the information in the Summary window.
6) Click Finish. The job should no longer be on the Checkouts tab.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-54 Chapter 5 Creating Metadata for Jobs
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.3 Solutions to Exercises 5-55
l. Select File Save to save the diagram and job metadata to this point.
m. Specify the properties of the Splitter transformation.
1) Right-click the Splitter transformation and select Properties.
2) Click the Row Selection tab.
3) Specify the subsetting criteria for the DIFT Recent Orders table object.
a) Verify that the DIFT Recent Orders table object is selected in the Target Tables pane.
b) Select Row Selection Conditions in the Row Selection Type field.
c) Click Subset Data below the Selection Conditions area. The Expression window appears.
d) Click the Data Sources tab.
e) Expand the OrderFact table.
f) Select the OrderDate column.
g) Click Add to Expression.
h) Click in the operators area.
i) Enter '01jan2009'd.
j) Click Validate Expression.
k) Click No to not display the SAS log.
l) Click OK to close the Expression Builder window.
4) Specify the subsetting criteria for the DIFT Old Orders table object.
a) Verify that the DIFT Old Orders table object is selected in the Target Tables pane.
b) Select Row Selection Conditions in the Row Selection Type field.
c) Click Subset Data below the Selection Conditions area. The Expression window appears.
d) Click the Data Sources tab.
e) Expand the OrderFact table.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-56 Chapter 5 Creating Metadata for Jobs
i) Enter '01jan2009'd.
j) Click Validate Expression.
k) Click No to not display the SAS log.
l) Click OK to close the Expression Builder window.
5) Click the Mappings tab.
6) Verify that all target table columns are mapped. (That is, all target columns receive data from
a source column.)
7) Click OK to close the Splitter Properties window.
n. Select File Save to save the diagram and job metadata to this point.
o. Run the job.
1) Click Run to run the job.
2) Click the Status tab in the Details pane. Notice that all processes complete successfully.
3) Click the Log tab to view the log for the executed job.
4) Scroll to view the notes about the creation of the DIFTTGT.RECENT_ORDERS table and
the creation of the DIFTTGT.OLD_ORDERS table.
5) Click the Diagram tab to view the data results.
6) View the DIFT Recent Orders table.
a) Right-click the DIFT Recent Orders table and select Open.
b) The DIFT Recent Orders table should have 615,396 rows.
c) When you are finished viewing the data, select File Close to close the
View Data window.
7) View the DIFT Old Orders table.
a) Right-click the DIFT Old Orders table and select Open.
b) The DIFT Old Orders table should have 336,273 rows.
c) When you are finished viewing the data, select File Close to close the
View Data window.
p. Select File Close to close the Job Editor. The new job object appears on the Checkouts tab.
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.3 Solutions to Exercises 5-57
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-58 Chapter 5 Creating Metadata for Jobs
Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
Chapter 6 Orion Star Case Study
6.1 Exercises ......................................................................................................................... 6-3
Defining and Loading the Customer Dimension Table ........................................................... 6-9
Defining and Loading the Organization Dimension Table .................................................... 6-11
Defining and Loading the Time Dimension Table ................................................................. 6-14
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.1 Exercises 6-3
6.1 Exercises
Objectives
Review the Orion Star data mart.
Create the jobs to complete the Orion Star data mart.
Organization Customer
Dimension Dimension
Order
Fact table
Product Time
Dimension Dimension
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6-4 Chapter 6 Orion Star Case Study
Orders Order_Item
Product_List Supplier
Information
This process was completed in a previous
5
demonstration.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.1 Exercises 6-5
Organization Staff
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6-6 Chapter 6 Orion Star Case Study
Organization Customer
Dimension Dimension
Order
Fact table
Product Time
Dimension Dimension
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.1 Exercises 6-7
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6-8 Chapter 6 Orion Star Case Study
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.1 Exercises 6-9
Original Column
(in DIFT CUSTOMER) Rename as
Customer_ID
Country Customer_Country
Gender Customer_Gender
Customer_Name
Customer_FirstName
Customer_LastName
Birth_Date Customer_Birth_Date
From the DIFT Customer Types table, import the following column metadata:
Original Column
(in DIFT Customer Types)
Customer_Type
Customer_Group
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6-10 Chapter 6 Orion Star Case Study
The join should include all rows from the DIFT CUSTOMER table and only matching rows from
the DIFT Customer Types table.
The join condition should be based on the Customer_Type_ID column.
The join data should be subset using the following expression:
Two target columns are computed in the Join transformation (Customer_Age and
Customer_Age_Group). The expressions are shown below.
Column Expression
Customer_Age
Customer_Age_Group
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.1 Exercises 6-11
Employee_ID
Org_Name Employee_Name
Country Employee_Country
From the DIFT STAFF table, import (and rename) the following column metadata:
Original Column
(in DIFT STAFF) Rename as
Job_Title
Salary
Gender Employee_Gender
Birth_Date Employee_Birth_Date
Emp_Hire_Date Employee_Hire_Date
Emp_Term_Date Employee_Term_Date
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6-12 Chapter 6 Orion Star Case Study
Group 40 Character
Section 40 Character
Department 40 Character
Company 30 Character
Create metadata for a simple index based on Employee_ID.
7. Defining the Job Metadata for the Organization Dimension
The specifics for the job to load the DIFT Organization Dimension table are shown below.
Name the job DIFT Populate Organization Dimension Table.
Store the metadata job object in the /Data Mart Development/Orion Jobs folder.
Use the Join transformation to join the source tables DIFT STAFF and DIFT
ORGANIZATION.
Use the Table Loader transformation for the final loading of the DIFT Organization Dimension
table.
The join should include all rows from the DIFT STAFF table and only matching rows from the
DIFT ORGANIZATION table.
The join condition should be based on the Employee_ID column.
The join data should be subset using the following expression:
The join work table should have the DIFT ORGANIZATION table columns.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.1 Exercises 6-13
Four target columns are computed in the Join transformation: Group, Section, Department, and
Company.
Because of the nested complexities of the expressions for these columns, it is best to add four
temporary columns to hold intermediate results. Add these four temporary columns to the join
work table before the Group, Section, Department, and Company columns.
Name Expression
The metadata for these four columns can be imported from the DIFT Organization
Dimension metadata table object (from the Checkouts tab). The text for the expressions can
be found in HelperFile.txt.
Verify that all columns for the Table Loaders target table have a defined mapping.
Run the job. The Organization Dimension table should have 1,048 rows and 13 columns.
8. Checking In the Metadata for the Organization Dimension
After you verify that the job completed successfully, check in all of the objects.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6-14 Chapter 6 Orion Star Case Study
WeekDay_Num 8 Numeric
WeekDay_Name 9 Character
Month_Num 8 Numeric
Year_ID 4 Character
Month_Name 9 Character
Quarter 6 Character
Holiday_US 26 Character
Fiscal_Year 4 Character
Fiscal_Month_Num 8 Numeric
Fiscal_Quarter 6 Character
The physical table, a SAS table, should be named TimeDim, and stored in the DIFT Orion
Target Tables Library.
Create metadata for a simple index based on Date_ID.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.1 Exercises 6-15
For Method 2:
In SAS Data Integration Studio, select Tools Code Editor.
In the Code Editor window, include the TimeDim.sas program from the
D:\Workshop\dift\SASCode directory.
Run the program and verify that no errors were generated in the Log window.
In SAS Data Integration Studio, invoke the Register Tables Wizard.
Select SAS as the table type, and select DIFT Orion Target Tables Library.
Select the TIMEDIM table. It should be available as a result of running the TimeDim.sas
program.
Store the metadata object in the \Data Mart Development\Orion Target Data folder.
Name the metadata table object DIFT Time Dimension.
Verify (update if necessary) that the length of Date_ID is 4.
Create metadata for a simple index based on Date_ID.
In the Code Editor window, remove the comment indicators from the PROC DATASETS step and
run only that step. Verify that the TimeDim table is deleted. (Check the log.) You re-create this
table via a SAS Data Integration Studio job.
Close the Code Editor window. (Select File Close.) Do not save any changes.
10. Defining the Job Metadata for the Time Dimension
The specifics for the job to load the DIFT Time Dimension table are shown below.
Name the job DIFT Populate Time Dimension Table.
Store the metadata object in the /Data Mart Development/Orion Jobs folder.
Use the User Written Code transformation to specify the code to load this table.
The code for this transformation is found in TimedimNoLibname.sas in the
D:\Workshop\dift\SASCode directory. This code loads the DIFT Time Dimension table.
Add the Table Loader transformation to the process flow for visual effect but specify to exclude
this transformation from running. (Select Exclude transformation from run in the Table Loader
properties on the Code tab.)
Add the DIFT Time Dimension target table to the process flow.
Open the Job Properties window and click the Precode and Postcode tab.
Enter the following LIBNAME statement as precode:
Run the job. The Time Dimension table should have 4,384 rows and 11 columns.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6-16 Chapter 6 Orion Star Case Study
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.2 Solutions to Exercises 6-17
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6-18 Chapter 6 Orion Star Case Study
i. Select DIFT Orion Target Tables Library as the value for the Library field.
j. Enter CustDim in the Name field.
k. Click Next. The Select Columns window appears.
l. Expand the Data Mart Development Orion Source Data folder on the Folders tab.
m. Locate and expand the DIFT Customer Types table object.
n. Select the Customer_Type and Customer_Group columns from DIFT Customer Types
and click to move the columns to the Selected pane.
o. Click the Checkouts tab.
p. Expand the DIFT CUSTOMER table object.
q. Select the following columns from DIFT CUSTOMER and click to move the columns
to the Selected pane:
Customer_ID
Country
Gender
Customer_Name
Customer_FirstName
Customer_LastName
Birth_Date
r. Click Next.
s. Change the names of the following columns:
Country Customer_Country
Gender Customer_Gender
Birth_Date Customer_Birth_Date
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.2 Solutions to Exercises 6-19
4) Select the Customer_ID column and move it to the Indexes pane by clicking .
5) Click OK.
v. Click Next.
w. Review the metadata listed in the summary window.
x. Click Finish.
The new table object, DIFT Customer Dimension, appears on the Checkouts tab.
3. Defining the Job Metadata for the Customer Dimension
a. Click the Folders tab.
b. Expand Data Mart Development Orion Jobs.
c. Verify that the Orion Jobs folder is selected.
d. Select File New Job. The New Job window appears.
1) Enter DIFT Populate Customer Dimension Table in the Name field.
2) Verify that the location is set to /Data Mart Development/Orion Jobs.
3) Click OK. The Job Editor window appears.
e. Add the source data objects to the process flow.
1) Click the Checkouts tab.
2) Right-click the DIFT CUSTOMER table object and select Add to Diagram.
3) Click the Folders tab.
4) If necessary, expand Data Mart Development Orion Source Data.
5) Right-click the DIFT Customer Types table object and select Add to Diagram.
6) Separate the two table objects in the Diagram Editor.
f. Select File Save to save the diagram and job metadata to this point.
g. Add the Join transformation to the diagram.
1) In the tree view, click the Transformations tab.
2) Expand the SQL grouping.
3) Select the Join transformation.
4) Drag the Join transformation to the diagram.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6-20 Chapter 6 Orion Star Case Study
5) Position the Join transformation so that it is centered between the DIFT CUSTOMER table
object and the DIFT Customer Types table object.
h. Add inputs to the Join transformation.
1) Click the DIFT CUSTOMER connection selector and draw a line to one of the input ports of
the Join transformation.
2) Click the DIFT Customer Types connection selector and draw a line to the other input port
of the Join transformation.
i. Select File Save to save the diagram and job metadata to this point.
j. Add the target table to the diagram.
1) Right-click the output work table for the Join transformation and select Replace.
The Table Selector window appears.
2) Click the Checkouts tab.
3) Select DIFT Customer Dimension.
4) Click OK.
k. Select File Save to save the diagram and job metadata to this point.
l. Review the properties of the Join transformation.
1) Right-click the Join transformation and select Open. The Designer window appears.
2) Click the Join item ( ) in the Navigate pane (the item identifying the join type).
3) In the Join Properties pane, select Left as the join type.
Join criteria for outer joins are added to an ON clause in the SQL code.
4) Establish the join criteria.
a) Click away from the Join item in the Navigate pane. For example, click the From item in
the Navigate pane.
b) Click the Join item in the Navigate pane to surface the Join tab.
c) In the Join tab on the left, click New.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.2 Solutions to Exercises 6-21
d) In the first Operand field, click and then select Choose column(s).
e) Expand DIFT Customer Types and select Customer_Type_ID.
f) Click OK.
g) In the Operator field, verify that the operator is =.
h) In the second Operand field, click Choose column(s).
i) Expand DIFT Customer and select Customer_Type_ID.
j) Click OK.
b) Double-click the Where item in the SQL Clauses pane to add a WHERE clause.
c) Click the Where item in the Navigate pane to surface the Where tab in the main area.
d) Click New.
e) In the first Operand field, click and then select Choose column(s).
f) Expand DIFT Customer Types and select Customer_Type_ID.
g) Click OK.
h) In the Operator field, click and then select >=.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6-22 Chapter 6 Orion Star Case Study
i) Click the second Operand field, type 0, and then press Enter.
Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.