Sei sulla pagina 1di 300

SAS® Data Integration

Studio: Fast Track

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.

SAS® Data Integration Studio: Fast Track Course Notes

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

Course Description ....................................................................................................................... x

Prerequisites ................................................................................................................................ xi

Chapter 1 Introduction .......................................................................................... 1-1

1.1 Exploring the Platform for SAS Business Analytics ....................................................... 1-3

1.2 Introduction to the Data Management Applications ...................................................... 1-11

Demonstration: Using SAS Data Integration Studio............................................... 1-19

Demonstration: Using Data Management Studio to Profile Data ........................... 1-46

1.3 Introduction to the Classroom Environment and the Course Tasks ............................... 1-57

Exercises.................................................................................................................. 1-70

1.4 Solutions to Exercises .................................................................................................... 1-82

Chapter 2 Working with Change Management .................................................... 2-1

2.1 Introduction to Change Management ............................................................................... 2-3

Demonstration: Exploring the Basics of Change Management ................................ 2-7

2.2 Establishing a Change Management Environment (Self-Study) ................................... 2-17

Demonstration: Creating a Project Repository ....................................................... 2-19

Exercises.................................................................................................................. 2-28

2.3 Solutions to Exercises .................................................................................................... 2-29

Chapter 3 Creating Metadata for Source Data ..................................................... 3-1

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

3.2 Registering Source Data Metadata ................................................................................. 3-13


iv For Your Information

Demonstration: Registering Metadata for SAS Source Tables ............................... 3-15

Demonstration: Registering Metadata for Oracle Data Sources ............................. 3-23

Demonstration: Registering Metadata for ODBC Data Sources ............................. 3-35

Demonstration: Registering Metadata for an External File .................................... 3-45

Exercises.................................................................................................................. 3-53

3.3 Solutions to Exercises .................................................................................................... 3-55

Chapter 4 Creating Metadata for Target Data ...................................................... 4-1

4.1 Registering Target Data Metadata .................................................................................... 4-3

Demonstration: Defining the Product Dimension Table Metadata ........................... 4-6

Exercises.................................................................................................................. 4-13

4.2 Importing Metadata ........................................................................................................ 4-15

Demonstration: Importing Relational Metadata ...................................................... 4-18

4.3 Solutions to Exercises .................................................................................................... 4-24

Chapter 5 Creating Metadata for Jobs ................................................................. 5-1

5.1 Introduction to Jobs and the Job Editor ........................................................................... 5-3

Demonstration: Populating the Current and Terminated Staff Tables ....................... 5-6

5.2 Using the Join Transformation ....................................................................................... 5-23

Demonstration: Populating the Product Dimension Table ...................................... 5-30

Exercises.................................................................................................................. 5-49

5.3 Solutions to Exercises .................................................................................................... 5-50

Chapter 6 Orion Star Case Study.......................................................................... 6-1

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

6.2 Solutions to Exercises .................................................................................................... 6-17


For Your Information v

Defining and Loading the Customer Dimension Table ........................................... 6-17

Defining and Loading the Organization Dimension Table ...................................... 6-24

Defining and Loading the Time Dimension Table .................................................. 6-32

Chapter 7 Additional Features for Jobs ............................................................... 7-1

7.1 Importing SAS Code ........................................................................................................ 7-3

Demonstration: Importing SAS Code ....................................................................... 7-8

Exercises.................................................................................................................. 7-16

Demonstration: Importing Macro-Based SAS Code ............................................... 7-19

Exercises.................................................................................................................. 7-81

7.2 Propagation and Mapping .............................................................................................. 7-32

Demonstration: Investigating Column Propagation, Mapping, and Updating ........ 7-38

7.3 Chaining Jobs ................................................................................................................. 7-58

Demonstration: Chaining Jobs ................................................................................ 7-59

7.4 Performance Statistics .................................................................................................... 7-62

Demonstration: Investigating Performance Statistics ............................................. 7-64

7.5 Metadata Reports ........................................................................................................... 7-70

Demonstration: Using the Reports Window ........................................................... 7-71

Exercises.................................................................................................................. 7-76

7.6 Solutions to Exercises .................................................................................................... 7-77

Chapter 8 Working with Transformations ............................................................ 8-1

8.1 Introduction ...................................................................................................................... 8-3


Demonstration: Creating Orion Reports Subfolders ................................................. 8-5

8.2 Using the Extract and Summary Statistics Transformations ............................................ 8-6
Demonstration: Using the Extract and Summary Statistics Transformations ........... 8-8

Exercises.................................................................................................................. 8-21

8.3 Exploring the SQL Transformations .............................................................................. 8-26


vi For Your Information

Demonstration: Using the Set Operators Transformation ....................................... 8-28

Exercises (Optional) ................................................................................................ 8-40

8.4 Establishing Status Handling ......................................................................................... 8-41

Demonstration: Working with Transformation and Job Status Handling ............... 8-44

Demonstration: Using the Return Code Check Transformation ............................. 8-50

8.5 Using the Data Validation Transformation..................................................................... 8-54

Demonstration: Using the Data Validation Transformation .................................... 8-57

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

8.7 Basic Standardizations ................................................................................................... 8-87

Demonstration: Using the Standardization Transformations .................................. 8-89

8.8 Solutions to Exercises .................................................................................................... 8-98

Chapter 9 Working with the Loop Transformations............................................ 9-1

9.1 Introduction to the Loop Transformations ....................................................................... 9-3

9.2 Iterating a Job................................................................................................................... 9-7

Demonstration: Exploring the Summary Statistics Transformation.......................... 9-8

Demonstration: Creating an Iterative Job ............................................................... 9-15

Exercises.................................................................................................................. 9-28

9.3 Iterating a Single Transformation .................................................................................. 9-32

Demonstration: Iterating the Create Table Transformation ..................................... 9-36


Demonstration: Using PROC METALIB ............................................................... 9-50

Demonstration: Enable Parallel Processing ............................................................ 9-56


Exercises.................................................................................................................. 9-59

9.4 Solutions to Exercises .................................................................................................... 9-60


For Your Information vii

Chapter 10 Working with Slowly Changing Dimensions.................................... 10-1

10.1 Defining Slowly Changing Dimensions ........................................................................ 10-3

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.3 Using the SCD Type 1 Loader Transformation............................................................ 10-72

Demonstration: Using the SCD Type 1 Transformation ....................................... 10-77

10.4 Introducing the Change Data Capture Transformations (Self-Study) .......................... 10-85

Demonstration: Using the CDC Transformation ................................................... 10-96

Exercises.............................................................................................................. 10-115

10.5 Solutions to Exercises ................................................................................................ 10-116

Chapter 11 Creating Custom Transformations ................................................... 11-1

11.1 SAS Data Integration Studio Transformations ............................................................... 11-3

11.2 Using the New Transformation Wizard ......................................................................... 11-8

Demonstration: Creating a Generated Transformation ......................................... 11-11

Exercises................................................................................................................ 11-27

11.3 Solutions to Exercises .................................................................................................. 11-30

Chapter 12 Working with the Table Loader Transformations ............................ 12-1

12.1 Basics of the Table Loader Transformations .................................................................. 12-3

12.2 Load Styles of the Table Loader Transformation ........................................................... 12-8

Demonstration: Using Load Styles of the Table Loader Transformation.............. 12-14

12.3 Managing Indexes and Constraints during Loading .................................................... 12-28

Demonstration: Using Table Loader Options to Manage Constraints and


Indexes ........................................................................................ 12-35

12.4 Bulk Loading DBMS Tables ........................................................................................ 12-42

Demonstration: Using the Oracle Bulk Table Loader Transformation ................. 12-45
viii For Your Information

Chapter 13 Working with Databases .................................................................... 13-1

13.1 Introduction to In-Database Processing ......................................................................... 13-3

13.2 Using In-Database Processing ....................................................................................... 13-7

Demonstration: Using In-Database Processing Techniques .................................. 13-12

Exercises................................................................................................................ 13-17

13.3 ELT Processing ............................................................................................................ 13-20

Demonstration: Creating an ELT Process ............................................................. 13-23

13.4 Using Oracle Functions................................................................................................ 13-34

Demonstration: Using Oracle Functions in SQL Join Expressions....................... 13-38

Demonstration: Creating and Using Oracle User-Defined Functions ................... 13-49

13.5 Solutions to Exercises .................................................................................................. 13-57

Chapter 14 Additional Topics for SAS® Data Integration Studio Users ............ 14-1

14.1 Overview ........................................................................................................................ 14-2

14.2 Analyzing Metadata Using Impact Analysis .................................................................. 14-3

Demonstration: Exploring Impact and Reverse Impact Analysis ........................... 14-5

14.3 Comparing Tables .......................................................................................................... 14-9

Demonstration: Using the Compare Tables Transformation ................................. 14-12

Exercises................................................................................................................ 14-21

14.4 Conditional Execution ................................................................................................. 14-22


Demonstration: Using the Conditional Execution Transformations ..................... 14-24

14.5 Metadata Promotion ..................................................................................................... 14-34

Demonstration: Exporting and Importing Metadata ............................................. 14-37

14.6 Version Control ............................................................................................................ 14-44


Demonstration: Creating a Version of a Metadata Object ..................................... 14-48

14.7 Establishing Checkpoints ............................................................................................. 14-60

Demonstration: Adding Checkpoints to a Job ...................................................... 14-63


For Your Information ix

14.8 Solutions to Exercises .................................................................................................. 14-68

Chapter 15 Deploying Jobs ................................................................................... 15-1

15.1 Introduction .................................................................................................................... 15-3

15.2 Deploying Jobs for Scheduling ...................................................................................... 15-5

Demonstration: Scheduling Orion Jobs ................................................................ 15-10

15.3 Deploying Jobs in Batch .............................................................................................. 15-20

Demonstration: Using Batch Deployment ............................................................ 15-23

15.4 Deploying Jobs as Stored Processes ............................................................................ 15-29

Demonstration: Creating SAS Stored Processes from Report Jobs ...................... 15-34

Chapter 16 Implementing Data Quality Techniques (Self-Study) ...................... 16-1

16.1 SAS and Data Quality .................................................................................................... 16-3

Demonstration: Verifying Data Quality Settings .................................................... 16-9

16.2 Using the DataFlux Transformations ........................................................................... 16-10

Demonstration: Reviewing Two Data Management Studio Data Jobs ................. 16-14

Demonstration: Using the SAS Data Integration Studio DataFlux


Transformations........................................................................... 16-26
x For Your Information

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.

Also, see the SAS Bookstore on the web at http://support.sas.com/publishing/


for a complete list of books and a convenient order form.
For Your Information xi

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.2 Introduction to the Data Management Applications .................................................. 1-11


Demonstration: Using SAS Data Integration Studio ............................................................ 1-19
Demonstration: Using Data Management Studio to Profile Data ........................................ 1-46

1.3 Introduction to the Classroom Environment and the Course Tasks ....................... 1-57
Exercises .............................................................................................................................. 1-70

1.4 Solutions to Exercises ................................................................................................. 1-82


1-2 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-3

1.1 Exploring the Platform for SAS Business Analytics

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

The initial folder structure includes the following main components:

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 product’s 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

Metadata Users and Groups


In order to control access to SAS platform content,
SAS must know who makes each request and what
type of functionality is requested.

Users A user is an individual person or service


identity.
Groups A group is a set of users. Groups enable you
to easily specify permissions for similar users.

15
15

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-11

1.2 Introduction to the Data Management Applications

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

Data Integration Developer


Data integration developers collect, cleanse, and store
the data required for reporting and analysis.
Data integration developers primarily use the following
applications:
SAS Data Integration Studio
DataFlux Data Management Studio

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

The tree view can display the following components:


 The Folders tree and the Inventory tree both display metadata for objects that are registered on the
current metadata server, such as tables and libraries.
– The Folders tree displays the metadata folder hierarchy that is shared across the SAS platform. This
folder hierarchy can be customized and is used to organize metadata in a structure that meets the
needs of the user.
– The Inventory tree displays metadata in predefined categories that organize the metadata by type,
such as Table, Library, and so on.
– Not all metadata objects in the Inventory tree can be added or updated in SAS Data Integration
Studio. Some objects appear in the tree view for other reasons. For example, you cannot add or
update actions, conditions, or deployed flows in SAS Data Integration Studio, but they appear in
the tree view so that they can be included in the import and export of jobs. Likewise, you cannot
add or update information maps in SAS Data Integration Studio, but they appear in the tree view so
that they can be displayed in impact analysis.
 The Transformations tree provides access to transformations that can be added to SAS Data Integration
Studio jobs.
 The Checkouts tree is available to users working under change management. The Checkouts tree
displays metadata that is checked out for update, as well as any new metadata that is not checked in.
The Checkouts tree is not displayed in the view of SAS Data Integration Studio above.
 The Basic Properties pane displays the basic properties of an object selected in a tree view. To surface
this pane, select View Basic Properties from the menu bar.

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

Using SAS Data Integration Studio


This demonstration illustrates accessing SAS Data Integration Studio and exploring the basics of the
interface and the available options for customizing Data Integration Studio. This demonstration uses
predefined metadata objects.
1. Select Start All Programs SAS SAS Data Integration Studio 4.8.
2. Use Bruno’s credentials to log on.
a. Verify that the connection profile is My Server.

Do not click Set this connection profile as the default.


b. Click OK to close the Connection Profile window and to access the Log On window.
c. Type Bruno in the User ID field and Student1 in the Password field.

Do not click Save user ID and password in this profile.


d. Click OK to close the Log On window.
SAS Data Integration Studio appears.
3. If necessary, click the Folders tab in the tree view area.

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.

4. Click in front of Data Mart Development to expand this folder.


5. Click in front of the DIFT Demo folder to expand it.

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

7. Click the DIFT Test Job - OrderFact Table Plus object.

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

8. Click the DIFT Test Source Library object.

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

9. Click the DIFT Test Table - ORDER_ITEM table object.

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

10. Examine the properties of a table object in more detail.


a. Right-click DIFT Test Table - ORDER_ITEM and select Properties.

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

c. Click the Physical Storage tab.

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

The View Data toolbar contains the following items:


Tool Explanation

Specifies the number of the first row to be displayed.

Positions the data with the go-to row as the first displayed data line.

Navigates to the first record of data.

Navigates to the last page of data.

Switches to Browse mode.

Switches to Edit mode.

Enables printing.

Refreshes the view of the data.

Copies a selected item.

Displays the Search pane.


Displays the Sort By Columns tab in the View Data Query Options
window.
Displays the Filter tab in the View Data Query Options window.

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

13. Examine the properties of a library object in more detail.


a. Right-click DIFT Test Source Library and select Properties.

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.

15. Click Cancel to close the Display LIBNAME window.


16. Access the Job Editor window to examine the properties of the job objects in more detail.
a. Right-click DIFT Test Job - OrderFact Table Plus and select Open.

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

b. Click the DIFT Test Table - ORDERS table object.


Notice that the Details pane now has a Columns tab.
c. Click the Columns tab.

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

d. Click the Join transformation.


Notice that the Details pane now has a Mappings tab.

The full mapping functionality of the Join’s 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

The transformations execute in sequence. The currently executing transformation is highlighted.

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.

j. Create the system folder that is needed.


1) Access Windows Explorer by selecting Start All Programs Accessories
Windows Explorer.
2) Navigate to D:\Workshop\dift.
3) Create a new folder by clicking New folder.
4) Type testdm as the name of the new folder and then press Enter.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-33

k. Run the job again by clicking Run.


The Status tab in the Details pane shows that all, except the List Data transformation, completed
successfully.

l. Double-click Error for the List Data transformation.


The Details pane shifts its focus to the Warnings and Errors tab. The error indicates that the
physical file does not exist. However, because the file is to be created by the transformation, it is
more likely that the location for the file does not exist.

m. Create the system folder that is needed.


1) If necessary, access Windows Explorer by selecting Start All Programs Accessories
Windows Explorer.
2) Navigate to D:\Workshop\dift.
3) Create a new folder by clicking New folder.
4) Type reports as the name of the new folder and then press Enter.
n. Run only the List Data transformation.
1) Click the List Data transformation.

2) Click (Run Selected Transformations) in the job toolbar.

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:

p. If necessary, click No to not save changes to the job.


17. Investigate some of the options that are available for SAS Data Integration Studio by selecting
Tools Options.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-35

The General tab of the Options window appears.

18. Examine the Show advanced property tabs option.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-36 Chapter 1 Introduction

a. If the Show advanced property tabs check box is selected …

… then tabs such as Extended Attributes and Authorization do appear in the


Properties window for a specified object.

b. If the Show advanced property tabs check box is not selected …

… 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.

The selected object is DIFT Test Table - ORDERS.

b. If the check box for this option is selected …

… then the number of rows in the selected table is displayed.

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

20. Click the SAS Server tab in the Options window.


a. Verify that the SASApp server is selected as the value for the Server field.

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.

c. Click OK to close the Information window.


The application server can also be set and tested via the SAS Data Integration Studio
status bar. For example, if the application server is not defined, the status bar shows the
following:

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

21. Click the Job Editor tab.

The options on this tab affect the Job Editor.


a. Verify that the default selection in the Nodes area is Collapse.

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.

The displays in this course use the Collapse setting.


b. Verify that the default selections in the Statistics area are Collect runtime statistics and
Collect table statistics.

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:

d. Verify the following selections in the Automatic Settings area:

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

22. Click the View Data tab.

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.)

23. Click the Data Quality tab.


a. Verify that the following fields are set appropriately in the Data Quality area:
Default Locale: ENUSA
DQ Setup Location: D:\ProgramData\DataFlux\QKB\CI\2013A
Scheme Repository Type: Data Management Platform scheme (BFD)
Scheme Repository: D:\ProgramData\DataFlux\QKB\CI\2013A

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

c. Click OK to close the Options window.


SAS Data Integration Studio must be closed and re-opened to see the effect of the correct
path in the DataFlux Installation Folder field.
24. Select File Exit to close SAS Data Integration Studio.

The path to the DataFlux Installation Folder on the classroom image is


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

What Is Data Management Studio?


Data Management Studio provides an interface for the
following:
metadata analysis
data profiling
data quality
data integration
data monitoring
address standardization
data enrichment

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 organization’s 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

Using Data Management Studio to Profile Data

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 Bruno’s 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.

Main Menu Toolbar

Riser Bar Items

Riser Bars

Notice the following:


 The Information riser bar is selected.
 The navigation pane displays the Information items: Overview and Monitor.
 The Overview item is selected.
 The content pane displays the Overview information.
 The Overview information is displayed in portlets. There are six portlets in this display.
4. In the Navigation pane, click the Data riser bar.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-48 Chapter 1 Introduction

The Data riser bar gives access to the Data items.

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.

Data Connection Provides access to a data source.

Master Data Methodology for defining the best record for a resource, such as a customer
Foundations or a product.

5. Click Data Connections.

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.

Domain Enabled Connection that links an Authentication Server Domain to an ODBC


ODBC Connection Data Source Name.

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.

SAS Data Set Connection to a collection of SAS data sets.


Connection

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-49

6. Add a new Data Connection.


a. If necessary, click Data Connections in the navigation pane.
b. In the content pane, select New Data Connection SAS Data Set Connection.
1) Type DIFT Orion Data in the Name field.
2) Click next to the Directory field. The Browse For Folder window appears.
a) Navigate to D:\Workshop\dift\data.
b) Click OK.

3) Click Test connection. A Test connection window appears.

4) Click OK to close the Test connection window.


5) Click OK to close the SAS Data Set Connection window.
6) Click (refresh) to make the new data connection visible

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

9. Verify the default Quality Knowledge Base (QKB).


a. Click Quality Knowledge Bases in the navigation pane.
b. Verify that the default QKB is the one named QKB CI 2013A.

10. Verify the default repository definition.


a. Click the Repository Definitions item in the navigation pane.
b. Verify that a repository named DataFlux Sample is connected to Data Management Studio.

11. Create a new folder for a data profile.


12. Click the Folders riser bar.
13. Click to expand the DataFlux Sample repository.

a. Right-click the DataFlux Sample repository and select New Folder.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-52 Chapter 1 Introduction

b. Type profiles and press Enter.

14. Create a data profile.


a. Right-click the new Profiles folder and select New Profile.
b. Type DIFT Contacts Table in the Name field.

c. Click OK.
The profile opens in a new tab in Data Management Studio.

15. Specify the data source for the profile.


a. Verify that the Properties sub-tab is selected.

b. Click to expand DIFT Orion Data BASE SAS.


c. Click in front of the CONTACTS table.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.2 Introduction to the Data Management Applications 1-53

16. Define profile options.


a. Select Tools Default Profile Metrics.
b. Verify that all available metrics are selected.

The first four metrics take additional processing time to calculate,


so be judicious in their selection.
c. Click OK to close the Metrics window.
17. Select File Save Profile to save the profile to this point.
18. Run the profile.
a. Select Actions Run Profile Report.
b. Type Contacts Profile Run 001 in the Description field.

c. Click OK to close the Run Profile window.


The profile is executed. The status of the execution is displayed.

The Report tab becomes active.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-54 Chapter 1 Introduction

19. Review the Profile report.


a. Click to expand DIFT Orion Data BASE SAS CONTACTS.
b. Click the CONTACTS table.

The content pane displays the single-valued metrics for all the columns.
c. Click the STATE column.

There are 3276 values.


There are 61 unique values.
There are 21 patterns to the values.

Some metrics display (not


applicable), which indicates
that the metric calculation is
not applicable to that field type.

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

e. Click the Pattern Frequency Distribution tab.

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

7) Click OK to close the Chart Properties window.


The Chart window appears.

20. Select File Close Profile.


21. Select File Exit Data Management Studio.
22. Select File Exit to close SAS Data Integration Studio.

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

1.3 Introduction to the Classroom Environment and the


Course Tasks

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

Course Tasks – Step 1


Step 1: Investigate change management.

Change management is defined, and an existing


environment is used to explore basic functionalities of
change management. In addition, the steps for
establishing a change management environment can be
explored in the optional self-study section. These steps
include creating a project repository, setting correct
permissions, and establishing a new connection profile.

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

Course Tasks – Step 2


Step 2: Register metadata for source tables.

Many types of tables can function as sources for a data


mart. The Register Tables Wizards enable you to register
different types of tables, based on the physical structure
of the tables, so that they can be used as data sources.

For this step, you investigate the following types of source


data:
SAS tables
Oracle tables
ODBC data sources
You also use the External File Wizards.

46

Course Tasks – Step 3


Step 3: Register metadata for target tables.

The New Table Wizard enables you to register metadata


for a new table that could be used as a target table. The
metadata can include the following:
type of table
library for the new table
name of the new table
columns for the new table
indexes for the new table
For this step, you define metadata for a number of target
tables.

47

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-62 Chapter 1 Introduction

Course Tasks – Step 4


Step 4: Create jobs to load tables.

The Job Editor is used to define job flows that load or


populate target tables from sources.
Job flows involve metadata for source tables, target
tables, and transformations. The combination of the
sources, targets, and transformations specifies how the
data is extracted from the sources, transformed, and then
loaded into the target tables.

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

Course Tasks – Step 6


Step 6: Investigate additional job features.

This step expands the knowledge of features and


functionality of the Job Editor window. You explore how to
do the following:
create jobs by importing SAS code
work with mappings and propagations
chain jobs
work with performance statistics

50

Course Tasks – Step 7


Step 7: Investigate a variety of transformations.

Many transformations are available by default in SAS


Data Integration Studio. For this step, you investigate
each of the following transformations:
Extract Append
Summary Statistics Sort
Return Code Check Rank
Data Validation Apply Lookup
Set Operators Standardization
Transpose Standardization
with Definition

51

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-64 Chapter 1 Introduction

Course Tasks – Step 9


Step 9: Investigate slowly changing dimensions.
The practice of Slowly Changing
Organization Customer
Dimensions preserves a history of Dimension Dimension

changes to the business entities in


Order
a dimension table. The history can Fact Table

be used for historical reporting and Product Time

analysis. Dimension Dimension

SAS Data Integration Studio provides transformations for


Type I and Type II Slowly Changing Dimensions as well
as a Lookup transformation to retrieve the primary key
values for records that are loaded into the fact table.

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).

Alternate Data Models


Other possible data models include the single table (fully
denormalized model) and the snowflake (normalized
model).
single table snowflake
simple model efficient storage
easy to query complex model
data redundancy complex queries

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

Designing the Target Tables


The purpose of the data warehouse is to provide a basis
for business analytics. The tables in the data warehouse
must include the necessary data items to address the
reporting and analysis needs.
One approach to designing the data warehouse tables is
to gather the questions that need to be addressed. Group
them into business dimensions (such as customer
dimension and product dimension) and facts.
The questions determine what columns are needed in the
data warehouse tables. A study can then be conducted to
identify sources for the target table columns, including
direct (1:1) mappings as well as derived columns.

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.

Data Item Categorical? Analysis?

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:

Column Table Type Length Format Label

Birth_Date CUSTOMER num 4 DATE9. Customer Birth


Date

STAFF num 4 DATE9. Employee Birth


Date

City_ID CITY num 8 City ID

POSTAL_CODE num 8 City ID

STREET_CODE num 8 City ID

City_Name CITY char 30 City Name

POSTAL_CODE char 30 City Name

STREET_CODE char 30 City Name

Continent_ID CONTINENT num 4 Continent ID

COUNTRY num 4 Numeric Rep. for


Continent

Continent_Name CONTINENT char 30 Continent Name

CostPrice_Per_Unit ORDER_ITEM num 8 DOLLAR13.2 Cost Price Per Unit

Count STREET_CODE num 4 Frequency

Country CITY char 2 $COUNTRY. Country

COUNTRY char 2 Country


Abbreviation

CUSTOMER char 2 $COUNTRY. Customer Country

GEO_TYPE char 2 Country


Abbreviation

HOLIDAY char 2 Country’s Holidays

ORGANIZATION char 2 $COUNTRY. Country


Abbreviation

STATE char 2 $COUNTRY. Abbreviated


Country

STREET_CODE char 2 $COUNTRY. Abbreviated


Country

SUPPLIER char 2 $COUNTRY. Country

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-72 Chapter 1 Introduction

Column Table Type Length Format Label

Country_Former_Name COUNTRY char 30 Former Name of


Country

Country_ID COUNTRY num 4 Country ID

Country_Name COUNTRY char 30 Current Name of


Country

County_ID COUNTY num 8 County ID

STREET_CODE num 8 County ID

County_Name COUNTY char 60 County Name

County_Type COUNTY num 4 GEO_TYPE. County Type

Customer_Address CUSTOMER char 45 Customer Address

Customer_FirstName CUSTOMER char 20 Customer First


Name

Customer_Group CUSTOMER_TYPE char 40 Customer Group


Name

Customer_Group_ID CUSTOMER_TYPE num 3 Customer Group


ID

Customer_ID CUSTOMER num 8 Customer ID

ORDERS num 8 Customer ID

Customer_LastName CUSTOMER char 30 Customer Last


Name

Customer_Name CUSTOMER char 40 Customer Name

Customer_Type CUSTOMER_TYPE char 40 Customer Type


Name

Customer_Type_ID CUSTOMER num 3 Customer Type ID

CUSTOMER_TYPE num 3 Customer Type ID

Delivery_Date ORDERS num 4 DATE9. Date Order was


Delivered

Discount DISCOUNT num 8 PERCENT. Discount as Percent


of Normal Retail
Sales Price

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

Column Table Type Length Format Label

ORDER_ITEM num 8 PERCENT. Discount in percent


of Normal Total
Retail Price

Emp_Hire_Date STAFF num 4 DATE9. Employee Hire


Date

Emp_Term_Date STAFF num 4 DATE9. Employee


Termination Date

Employee_ID ORDERS num 5 Employee ID

ORGANIZATION num 8 Employee ID

STAFF num 8 Employee ID

End_Date DISCOUNT num 5 DATE9. End Date

ORGANIZATION num 5 DATE9. End Date

PRICE_LIST num 5 DATE9. End Date

STAFF num 5 DATE9. End Date

Factor PRICE_LIST num 8 Yearly increase


in Price

Fmtname HOLIDAY char 7 Format Name

From_Street_Num STREET_CODE num 4 From Street


Number

Gender CUSTOMER char 1 $GENDER. Customer Gender

STAFF char 1 $GENDER. Employee Gender

Geo_Type_ID GEO_TYPE num 4 Geographical Type


ID

Geo_Type_Name GEO_TYPE char 20 Geographical Type


Name

HLO HOLIDAY char 1 High Low Other

Job_Title STAFF char 25 Employee Job Title

Label HOLIDAY char 40 Holiday Name

Manager_ID STAFF num 8 Manager for


Employee

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-74 Chapter 1 Introduction

Column Table Type Length Format Label

Order_Date ORDERS num 4 DATE9. Date Order was


placed
by Customer

Order_ID ORDERS num 8 Order ID

ORDER_ITEM num 8 Order ID

Order_Item_Num ORDER_ITEM num 3 Order Item Number

Order_Type ORDERS num 3 ORDER_TYPE. Order Type

Org_Level ORGANIZATION num 3 Organization Level


Number

ORG_LEVEL num 3 Organization Level


Number

Org_Level_Name ORG_LEVEL char 40 Organization Level


Name

Org_Name ORGANIZATION char 40 Organization Name

Org_Ref_ID ORGANIZATION num 8 Organization


Reference ID

Personal_ID CUSTOMER char 15 Personal ID

Population COUNTRY num 8 COMMA12. Population


(approx.)

Postal_Code POSTAL_CODE char 10 Postal Code

STREET_CODE char 10 Postal Code

Postal_Code_ID POSTAL_CODE num 8 Postal Code ID

STREET_CODE num 8 Postal Code ID

Product_ID DISCOUNT num 8 Product ID

ORDER_ITEM num 8 Product ID

PRICE_LIST num 8 Product ID

PRODUCT num 8 Product ID

PRODUCT_LIST num 8 Product ID

Product_Level PRODUCT num 3 Product Level

PRODUCT_LEVEL num 3 Product Level

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

Column Table Type Length Format Label

PRODUCT_LIST num 3 Product Level

Product_Level_Name PRODUCT_LEVEL char 30 Product Level


Name

Product_Name PRODUCT char 45 Product Name

PRODUCT_LIST char 45 Product Name

Product_Ref_ID PRODUCT num 8 Product Reference


ID

PRODUCT_LIST num 8 Product Reference


ID

Quantity ORDER_ITEM num 3 Quantity Ordered

Salary STAFF num 8 DOLLAR12. Employee Annual


Salary

Start HOLIDAY num 8 DATE9.

Start_Date DISCOUNT num 4 DATE9. Start Date

ORGANIZATION num 4 DATE9. Start Date

PRICE_LIST num 4 DATE9. Start Date

STAFF num 4 DATE9. Start Date

State_Code STATE char 2 State Code

State_ID STATE num 8 State ID

State_Name STATE char 30 State Name

State_Type STATE num 4 GEO_TYPE. State Type

Street_ID CUSTOMER num 8 Street ID

STREET_CODE num 8 Street ID

SUPPLIER num 8 Street ID

Street_Name STREET_CODE char 40 Street Name

Street_Number CUSTOMER char 8 Street Number

Sup_Street_Number SUPPLIER char 8 Supplier Street


Number

Supplier_Address SUPPLIER char 45 Supplier Address

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-76 Chapter 1 Introduction

Column Table Type Length Format Label

Supplier_ID PRODUCT num 4 Supplier ID

PRODUCT_LIST num 4 Supplier ID

SUPPLIER num 4 Supplier ID

Supplier_Name SUPPLIER char 30 Supplier Name

To_Street_Num STREET_CODE num 4 To Street Number

Total_Retail_Price ORDER_ITEM num 8 DOLLAR13.2 Total Retail Price


for This Product

Type HOLIDAY char 1 Type


Numeric/Character

Unit_Cost_Price PRICE_LIST num 8 DOLLAR13.2 Unit Cost Price

Unit_Sales_Price DISCOUNT num 8 DOLLAR13.2 Discount Retail


Sales
Price per Unit

PRICE_LIST num 8 DOLLAR13.2 Unit Sales Price

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

2. Planning for the Product Dimension Table


The columns and column attributes specified for the product dimension table are shown below.

Column Type Length Format Label

Product_ID num 8 Product ID

Product_Category char 25 Product Category

Product_Group char 25 Product Group

Product_Line char 20 Product Line

Product_Name char 45 Product Name

Supplier_Country char 2 $COUNTRY. Supplier Country

Supplier_ID num 4 Supplier ID

Supplier_Name char 30 Supplier Name

Source columns for the product dimension


Complete this table by listing the source table and column for each target column in the product
dimension table. Minimize the number of source tables.

Target Source Source Computed


Column Table Column Column? (X)

Product_ID

Product_Category

Product_Group

Product_Line

Product_Name

Supplier_Country

Supplier_ID

Supplier_Name

3. Diagram for the Product Dimension Table


Sketch a diagram for the product dimension table. The diagram should show the flow of data from the
sources to the target. Include the following in the diagram:
 the source tables
 the calculated columns
 the target table (Product Dimension table)

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-78 Chapter 1 Introduction

Product Area Data Items: Exercise 1


Data Column Categorical Data? Analysis Data?
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
65

Product Area Source Columns: Exercise 2


Target Source Source Computed
Column Table Column Column
Product_ID PRODUCT_LIST Product_ID

Product_Category X

Product_Group X

Product_Line X

Product_Name PRODUCT_LIST Product_Name

Supplier_Country SUPPLIER Country

Supplier_ID SUPPLIER Supplier_ID

Supplier_Name SUPPLIER Supplier_Name

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

Product Dimension Diagram: Exercise 3


The product dimension Product
table is populated from Dimension
two sources. Computed
The source table and Columns
target table objects Product_Group
must be defined in Product_Category
metadata, as well as Product_Line
in the process flow.
Three computed columns
are defined for the target
table.
Product_List Supplier Information
or
PRODUCT
67

Star Schema (Review)


The data mart is modeled in the form of a star schema
with a fact table and four dimension tables. Each table
requires an ETL job.

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

Order Fact Table Diagram


The order fact table
process is populated OrderFact
from two sources. Computed
The source table and Columns
target table objects
must be defined in NONE!
metadata, as well as
in the process flow.
No computed columns
are defined for the
target table.
Orders Order_Item

69

Customer Dimension Table Diagram


The customer dimension Customer
table is populated from Dimension
two sources. Computed
The source table and Columns
target table objects
must be defined in Customer_Age
Customer_Age_Group
metadata, as well as
in the process flow.
Two computed columns
are defined for the target
table.
Customer Customer Types

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

Organization Dimension Table Diagram


The organization Organization
dimension table is Dimension
populated from two Computed
sources. Columns
The source table and Group
target table objects Section
Department
must be defined in
Company
metadata, as well as
in the process flow.
Four computed columns
are defined for the target
table. Organization Staff

71

Time Dimension Table Diagram


The time dimension Time
table is populated from Dimension
user-written code. No Computed
source table is Columns
needed.
All Columns!!
The target table object (User-written code
generates the
must be defined in
TimeDim table.)
metadata.
The user-written code
must be developed.

72

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1-82 Chapter 1 Introduction

1.4 Solutions to Exercises


1. Listing Data Items to Address Business Questions in the Product Area

Data Column Categorical Data? Analysis Data?

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

No additional data items were added.


2. Planning for the Product Dimension Table
a. Complete the table. List the source tables and the columns in those tables that are involved in
determining the values that are loaded in the ProdDim table.

Target Source Source Computed


Column Table Column Column

Product_ID PRODUCT_LIST Product_ID

Product_Category X

Product_Group X

Product_Line X

Product_Name PRODUCT_LIST Product_Name

Supplier_Country SUPPLIER Country

Supplier_ID SUPPLIER Supplier_ID

Supplier_Name SUPPLIER Supplier_Name

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
1.4 Solutions to Exercises 1-83

3. Diagram for the Product Dimension Table

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

2.2 Establishing a Change Management Environment (Self-Study) .............................. 2-17


Demonstration: Creating a Project Repository .................................................................... 2-19
Exercises .............................................................................................................................. 2-28

2.3 Solutions to Exercises ................................................................................................. 2-29


2-2 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-3

2.1 Introduction to Change Management

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

Working under Change Management


Under change management, users are restricted from
directly adding or updating metadata in a change-
managed repository.
Authorized users, however, can do the following:
check out existing metadata objects to their project
repositories to update them
create new metadata objects in their project
repositories
New and updated metadata objects can then be checked
in from the project repository to the change-managed
repository.

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

Exploring the Basics of Change Management

This demonstration illustrates using the change management feature of SAS Data Integration Studio.

Accessing SAS Data Integration Studio Using Kari’s Project Repository


1. Select Start All Programs SAS SAS Data Integration Studio 4.8.
2. Log on using Kari’s credentials to access her project repository.
a. Select Kari’s Work Repository as the connection profile.

Do not click Set this connection profile as the default.


b. Click OK to close the Connection Profile window and open the Log On window.
c. Enter Kari in the User ID field and Student1 in the Password field.

Do not click Save user ID and password in this profile.


d. Click OK to close the Log On window.
SAS Data Integration Studio appears.

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.

6. Click OK to close the Information window.


7. Click OK to close the Default Application Server window. The status bar is updated to the following:

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.

A checkmark ( ) is added to the icons for the three objects.

13. Click the Checkouts tab.


The three checked-out objects are shown on the Checkouts tab.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-10 Chapter 2 Working with Change Management

14. Right-click DIFT Test Table - ORDER_ITEM and select Properties.


15. Type Testing out Change Management in the Description field.

16. Click OK to close the Properties window.


17. Right-click DIFT Test Table - ORDER_ITEM and select Check In (or select
Check Outs Check In with the table object selected). The Check In Wizard appears.
18. Type Added Description in the Title field.
19. Type Showing off features of Change Management - added a description to the table object. in
the Description field.

20. Click Next.


21. Verify that DIFT Test Table - ORDER_ITEM is selected.

22. Click Next.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.1 Introduction to Change Management 2-11

23. Review the Summary window.

24. Click Finish.


The Checkouts tab no longer has this table object.

Accessing SAS Data Integration Studio Using Ole’s Project Repository


1. Select Start All Programs SAS SAS Data Integration Studio 4.8.
2. Log on using Ole’s credentials to access his project repository.
a. Select Ole’s Work Repository as the connection profile.

Do not click Set this connection profile as the default.


b. Click OK to close the Connection Profile window and open the Log On window.
c. Type Ole in the User ID field and Student1 in the Password field.

Do not click Save user ID and password in this profile.


d. Click OK to close the Log On window.
SAS Data Integration Studio appears.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-12 Chapter 2 Working with Change Management

3. If necessary, set the default application server to SASApp.

4. Click the Checkouts tab.


5. Verify that no objects exist on the Checkouts tab.

6. Click the Folders tab.


7. Expand Data Mart Development DIFT Demo. Two objects are checked out (by Kari).

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

9. Right-click DIFT Test Source Library and select History.

Ole can see that Kari checked out the object.


10. Select File Close to close the History window.
11. Right-click DIFT Test Table - ORDER_ITEM and select History.

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.

15. Right-click DIFT Test Table - ORDER_ITEM and select Properties.


16. Clear the text in the Description field.

17. Click OK to close the Properties window.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-14 Chapter 2 Working with Change Management

Accessing SAS Data Integration Studio Using Ahmed’s Credentials


1. Select Start All Programs SAS SAS Data Integration Studio 4.8.
2. Log on using Ahmed’s credentials (an administrator) to access the Foundation repository.
a. Select My Server as the connection profile.
b. Click OK to close the Connection Profile window and open the Log On window.
c. Type Ahmed in the User ID field and Student1 in the Password field.
d. Click OK to close the Log On window. SAS Data Integration Studio appears. Ahmed does not
see a Checkouts tab.
3. If necessary, click the Folders tab.
4. Expand Data Mart Development DIFT Demo.
Three objects are checked out (by Kari and Ole).

5. Select Check Outs Clear Projects.


As an administrator, Ahmed can clear project repositories for all team members.

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.

9. Right-click DIFT Test Table - ORDER_ITEM and select Properties.


10. Verify that the change that Ole made to the Description field was not saved.

11. Click OK to close the Properties window.


12. Select File Exit to close Ahmed’s SAS Data Integration Studio session.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-16 Chapter 2 Working with Change Management

13. Access Ole’s SAS Data Integration Studio session.


This session was not refreshed, so it seems that Ole still has an object that is checked out.

14. Select View Refresh.


The Checkouts tab was active, so the metadata for the project repository is refreshed.

15. Click the Folders tab.


16. Select View Refresh.
The metadata is updated to show that no objects (in this folder) are checked out.

17. Select File Exit to close Ole’s SAS Data Integration Studio session.
18. Access Kari’s 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 Kari’s 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

2.2 Establishing a Change Management Environment (Self-


Study)

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

Creating a Project Repository

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 Ahmed’s 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.

Two project repositories are currently defined.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-20 Chapter 2 Working with Change Management

4. Create a new project repository.


a. Right-click the Project Repositories folder and select New Project Repository.
The Create New Project Repository Wizard appears.
b. Select Barbara as the user for whom this project repository is created.

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:

Online Specifies normal repository operation. The repository is accessible


to all authorized users for Read and Write operations.

ReadOnly Specifies that the metadata in the repository can be read,


but not modified or deleted.

Administration Specifies that only administrative users can access the repository.
To all others, the repository appears as if it were offline.

Offline Specifies that the repository is not accessible to any users.

g. Click Next.
h. Review the final settings.
i. Click Finish.
A message about the repository initialization appears.

j. Click OK to close the Information window.


The new project repository is added to the Project Repositories folder.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-22 Chapter 2 Working with Change Management

5. Set security for Barbara on the Data Mart Development folder.


a. Click the Folders tab.
b. Right-click the Data Mart Development folder and select Properties.
c. Click the Authorization tab.
d. Click Add. The Add Users and Groups window appears.
e. Double-click Barbara to move this identity to the Selected Identities list box.

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

k. Click OK to close the Data Mart Development Properties window.


6. Select File Exit to close SAS Management Console.
7. Create a connection profile for the new project repository.
a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Click Create a new connection profile.

c. Click OK to close the Connection Profile window.


The Connection Profile Wizard appears.

d. Click Next.
e. Type Barbara’s 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

g. Type SASBAP in the Machine field.


h. Type Barbara in the User ID field.
i. Type Student1 in the Password field.

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.

o. Click Finish. The Log On window appears.


p. Type Barbara in the User ID field.
q. Type Student1 in the Password field.

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 Barbara’s credentials to access Barbara’s 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.

d. Click OK to close the New Folder window.


e. Verify that the Test folder did not appear under Data Mart Development.
f. Click the Checkouts tab.
g. Verify that the Test folder appears on the Checkouts tab.

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.

d. Verify that the object is editable.


e. Click Cancel.
11. Remove the objects from the Checkouts tab.
a. Select Check Outs Undo Check Out.

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

1. Creating and Testing a Project Repository for Marcel


Marcel is a member of the Data Integrators group. Marcel needs to establish a project repository so
that he can work with his team members to build the data warehouse.
 Use Ahmed’s credentials to access SAS Management Console.
 Use the Metadata Manager to create a project repository for Marcel.
 Name the project repository Marcel Work Repository.
 Store the physical repository in
C:\SAS\Config\Lev1\SASMeta\MetadataServer\MetadataRepositories\MarcelWork.
 Deny Marcel WriteMetadata and WriteMemberMetadata access to the
Data Mart Development folder.
 Grant Marcel CheckInMetadata privileges to the Data Mart Development folder.
 Create a new connection profile for Marcel. Use Marcel Work Repository.
 Verify that Marcel cannot directly create a folder under Data Mart Development or edit an existing
metadata object.
 Verify that Marcel can check out an object and then edit the object from the Checkouts tab.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.3 Solutions to Exercises 2-29

2.3 Solutions to Exercises


1. Creating and Testing a Project Repository for Marcel
a. Access SAS Management Console. Use Ahmed’s credentials.
1) Select Start All Programs SAS SAS Management Console 9.4.
2) Verify that the default connection profile is My Server.
3) Click OK to close the Connection Profile window and open the Log On window.
4) Type Ahmed in the User ID field and Student1 in the Password field.
5) Click OK to close the Log On window.
b. If necessary, click the Plug-ins tab.
c. Expand Metadata Manager Active Server Project Repositories.
d. Create a new project repository.
1) Right-click the Project Repositories folder and select New Project Repository.
2) Select Marcel as the user for whom this project repository is created.
3) Click Next.
4) Type Marcel Work Repository in the Name field.
5) Click Next.
6) Specify information for attributes of the new project repository.
a) Verify that Base is the value for the Engine field.
b) Click Browse next to the Path field.
c) Navigate to C:\SAS\Config\Lev1\SASMeta\MetadataServer\MetadataRepositories.
d) Click to create a new folder.
e) Type MarcelWork and press Enter.
f) Verify that MarcelWork appears in the File name field and click OK.
7) Click Next.
8) Review the final settings.
9) Click Finish.
10) Click OK to close the Information window about repository initialization.
The new project repository is displayed under the Metadata Manager plug-in.
e. Set security for Marcel on the Data Mart Development folder.
1) Click the Folders tab.
2) Right-click the Data Mart Development folder and select Properties.
3) Click the Authorization tab.
4) Click Add.
5) Double-click Marcel to move this identity to the Selected Identities list box.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2-30 Chapter 2 Working with Change Management

6) Click OK to close the Add Users and Groups window.


7) Verify that Marcel is selected in the Users and Groups area.
8) In the Effective Permissions area, select Deny for WriteMetadata.
9) Select Deny for WriteMemberMetadata.
10) Select Grant for CheckInMetadata
11) Click OK to close the Data Mart Development Properties window.
f. Select File Exit to close SAS Management Console.
g. Create a connection profile for the new project repository.
1) From a SAS Data Integration Studio session, select File Connection Profile.
2) Click Yes in the message window.
3) Click Create a new connection profile.
4) Click OK to close the Connection Profile window. The Connection Profile Wizard appears.
5) Click Next.
6) Type Marcel’s Work Repository in the Name field.
7) Click Next.
8) Type SASBAP in the Machine field.
9) Type Marcel in the User ID field.
10) Type Student1 in the Password field.
11) Click Next.
12) Click Connect to a project.
13) Verify that Marcel Work Repository is selected.
14) Click Next.
15) Review the final settings.
16) Click Finish.
The Log On window appears.
17) Type Marcel in the User ID field.
18) Type Student1 in the Password field.
19) Click OK.
SAS Data Integration Studio appears and uses Marcel’s credentials to access Marcel’s project
repository.
h. Verify that Marcel does not have direct WriteMemberMetadata access to the Data Mart
Development folder.
1) If necessary, click the Folders tab.
2) Right-click the Data Mart Development folder and select New Folder.
3) Type Test in the Name field.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
2.3 Solutions to Exercises 2-31

4) Click OK to close the New Folder window.


5) Verify that the Test folder did not appear under Data Mart Development.
6) Click the Checkouts tab.
7) Verify that the Test folder appears on the Checkouts tab.
i. Verify that Marcel cannot directly edit the metadata objects in the Data Mart Development folder.
1) Click the Folders tab.
2) Click to expand Data Mart Development.
3) Click to expand DIFT Demo.
4) Right-click DIFT Test Table - ORDERS and select Properties.
The Properties window appears in Read-Only mode.
5) Click Cancel.
j. Check out DIFT Test Table - ORDERS and verify that Marcel can then edit it.
1) Right-click DIFT Test Table - ORDERS and select Check Out.
2) Click the Checkouts tab.
3) Right-click DIFT Test Table - ORDERS (on the Checkouts tab) and select Properties.
4) Verify that the object is editable.
5) Click Cancel.
k. Remove the objects from the Checkouts tab.
1) Select Check Outs Undo Check Out.
2) Click Yes.
3) Right-click the Test folder and select Delete.
4) Click Yes.
l. Exit SAS Data Integration Studio by selecting File Exit.

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

3.2 Registering Source Data Metadata ............................................................................. 3-13


Demonstration: Registering Metadata for SAS Source Tables ............................................ 3-15
Demonstration: Registering Metadata for Oracle Data Sources ......................................... 3-23
Demonstration: Registering Metadata for ODBC Data Sources .......................................... 3-35
Demonstration: Registering Metadata for an External File .................................................. 3-45
Exercises .............................................................................................................................. 3-53

3.3 Solutions to Exercises ................................................................................................. 3-55


3-2 Chapter 3 Creating Metadata for Source Data

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Setting Up the Environment 3-3

3.1 Setting Up the Environment

Objectives
Define administrative tasks to be performed for SAS
Data Integration Studio.
Use the New Library Wizard to define a SAS library.

SAS Data Integration Studio Setup


SAS Data Integration Studio relies on the following:
server definitions
library definitions
metadata folder structure
other resources
SAS Data Integration Studio resources are
configured by an administrator
available for use by Data Integration Studio
developers.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-4 Chapter 3 Creating Metadata for Source Data

Common Administrative Tasks


Some of the administrative tasks that must
be performed are the following:
set up folder structure for your site
set up database servers for data sources
set up libraries for data sources and data targets
set up change management
set up scheduling for deployed jobs
set up support for web services and stored processes

The first three tasks are discussed in this chapter.


The remaining tasks are discussed in the SAS® Data
Integration Studio 2: Additional Topics course.

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

Defining Custom Folders

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 administrator’s
credentials to complete this step.

Accessing SAS Data Integration Studio Using an Administrator’s Credentials


1. Select Start All Programs SAS SAS Data Integration Studio 4.8.
2. Log on with Ahmed’s credentials.
a. Select My Server as the connection profile.

Do not select Set this connection profile as the default.


b. Click OK to close the Connection Profile window and open the Log On window.
c. Enter Ahmed in the User ID field and Student1 in the Password field.

Do not select Save user ID and password in this profile.


d. Click OK to close the Log On window.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-6 Chapter 3 Creating Metadata for Source Data

SAS Data Integration Studio appears.

3. If necessary, click the Folders tab.


4. Expand the Data Mart Development folder.

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

Libraries are critical to SAS Data Integration Studio.


Metadata for sources, targets, or jobs cannot be finalized
until the appropriate libraries are registered.
Accordingly, one of the first tasks in a SAS Data
Integration Studio project is to specify metadata for the
libraries that contain or will contain sources, targets, or
other resources. At some sites, an administrator adds and
maintains most of the libraries that are needed, and the
administrator tells SAS Data Integration Studio users
which libraries to use.

New Library Wizard


The New Library Wizard is used to register a library.
With the wizard, you define the following:
the type of library
a metadata name for the library
the location of the library
a library reference
the SAS Application Server where this library is to be
assigned

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Setting Up the Environment 3-9

Defining Metadata for a SAS Library

This demonstration illustrates defining metadata for a SAS library. The tables in this library are
used as data sources for a data mart.

Accessing SAS Data Integration Studio Using a Data Integration Developer’s


Credentials
1. If necessary, select Start All Programs SAS SAS Data Integration Studio 4.8.
2. Log on with Kari’s credentials and access Kari’s project repository.
a. Select Kari’s Work Repository as the connection profile.
b. Click OK to close the Connection Profile window and open the Log On window.
c. Enter Kari in the User ID field and Student1 in the Password field.
d. Click OK to close the Log On window. SAS Data Integration Studio appears.

Defining Metadata for a 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.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-10 Chapter 3 Creating Metadata for Source Data

4. Select File New Library. The New Library Wizard appears.


5. Select SAS BASE Library as the type of library to create.

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.

b. Click to move SASApp to the Selected servers list box.

10. Click Next.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.1 Setting Up the Environment 3-11

11. Provide the library properties.


a. Enter diftodet in the Libref field.
b. Select D:\Workshop\OrionStar\ordetail in the Available items list box.
c. Click to move the selected path to the Selected items list box.

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 Kari’s 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

Folder Location: \Data Mart Development\Orion Source Data


SAS Server: SASApp
Libref: diftsas

Path Specification: D:\Workshop\dift\data


4. Checking in New Library Objects
Check in the new library objects. Specify the following for the check-in information:
Title: Adding two library objects

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

3.2 Registering Source Data Metadata

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

Register Tables Wizard


Register Used to register existing tables in a DBMS
Tables or ERP system, including SAS tables. The
Wizard wizard retrieves table and column properties
from the data dictionary or metadata
repository in the source system.

The result of running the Register Tables Wizard


successfully is a metadata registration that describes
one or more existing tables.

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

Registering Metadata for SAS Source Tables

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 Kari’s credentials.
a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Select Kari’s 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 Register Tables. The Register Tables Wizard appears.


Only the table types (SAS/ACCESS engines) that are licensed for your site are available for
use.
The following two alternatives are available to initiate the Register Tables Wizard:
 right-click a folder in the Folders tree where metadata for the table should be saved, and
then select Register Tables from the pop-up menu
 right-click a library and select Register Tables

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-16 Chapter 3 Creating Metadata for Source Data

6. Select SAS as the type of table.

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

10. Select the PRODUCT_LIST table.


11. Verify that /Data Mart Development/Orion Source Data is selected in the Location field.

If the location is incorrect, click Browse, and navigate to SAS Folders


Data Mart Development Orion Source Data.
12. Click Next. The review window appears.
13. Verify that the information is correct.

14. Click Finish.


The metadata object for the table is found in the Checkouts tree.

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.

Add DIFT prefix

Remove the description

18. Click the Columns tab to view the column properties.

Two columns have special symbols:


indicates that the Product_ID column is a primary key.
indicates that the Product_Level column is indexed.
19. Click the Indexes tab.
20. Expand the indexes to see the column names in each index.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-19

21. Click the Keys tab.


22. Click PRODUCT_LIST.Primary in the Keys pane to display the details of the primary key in the
Details area.

23. Click the Physical Storage tab.

Notice that the physical table name is PRODUCT_LIST.


24. Click OK to close the Properties window.

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.

26. Click to open the Query Options window.


27. Click Simple.
28. Select Product_Level in the Column field.
29. Verify that Equals is selected in the Filter type field.
30. Enter 4 in the Value field.

31. Click OK to close the Query Options window.

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

33. Enter 3 in the Value field.


34. Click OK to close the Query Options window.

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

Oracle Data Sources


Registering metadata for Oracle data sources includes
these steps:
define an Oracle database server in metadata
define an Oracle library in metadata that references
the Oracle database server
define metadata for Oracle tables from the Oracle
library

20

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-23

Registering Metadata for Oracle Data Sources

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.

Verifying That a Needed Oracle Server Definition Exists


1. Access SAS Management Console with Ahmed’s credentials.
a. Select Start All Programs SAS SAS Management Console 9.4.
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 Ahmed in the User ID field and Student1 in the Password field.
e. Click OK to close the Log On window. SAS Management Console appears.
2. If necessary, click the Plug-ins tab.
3. Click to expand the Server Manager plug-in.

Server Manager plug-in

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-24 Chapter 3 Creating Metadata for Source Data

4. Click the server definition named DIFT Oracle Server.


5. On the Connections tab, right-click the connection named Connection: DIFT Oracle Server and
select Properties.

Right-click and select Properties.

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.

Right-click and select Properties.

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

Defining Metadata for an Oracle Library


Because the Oracle server is defined, Kari can define the metadata object that represents a library for the
Oracle database.
1. If necessary, access SAS Data Integration Studio with Kari’s credentials.
a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Select Kari’s 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 Library. The New Library Wizard appears.
6. Click Oracle Library as the type of library.

7. Click Next.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-27

8. Enter DIFT Oracle Library in the Name field.


9. Verify that the location is set to /Data Mart Development/Orion Source Data.

10. Click Next.


11. Double-click SASApp in the Available servers list box to move it to the Selected servers list box.
12. Click Next.
13. Enter diftora in the Libref field.

14. Click Next.


15. Verify that DIFT Oracle Server is the value for the Database Server field.

16. Click Next.


The review window shows the following:

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

Defining Metadata for Oracle Tables


With the Oracle library defined, Kari can now define the metadata objects for the needed tables in the
Oracle database.
1. If necessary, 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. Expand the Database Sources folder.
6. Click Oracle as the type of table.

7. Click Next. The Oracle window appears.


8. Verify that DIFT Oracle Library is selected in the SAS Library field.

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.

12. Click Next.


The review window shows the following:

13. Click Finish.


The metadata table objects for the Oracle data sources, as well as the newly defined library object, are
found in the Checkouts tree.

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.

Column properties were retrieved from the database.


17. Click the Physical Storage tab.

Notice that the physical table name is ORDER_ITEM.


18. Click OK to close the Properties window.

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.

20. Select File Close to close the View Data window.


21. Right-click the ORDERS metadata table object and select Properties.
22. Enter DIFT ORDERS in the Name field.

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

24. Click the Physical Storage tab.

Notice that the physical table name is ORDERS.


25. Click OK to close the Properties window.
26. Right-click the DIFT ORDERS metadata table object and select Open.
The View Data window appears.

27. Select File Close to close the View Data window.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-33

ODBC Data Sources


Registering metadata for ODBC data sources includes
these steps:
define the ODBC data source name (DSN) to the
operating system.
define an ODBC server in SAS metadata pointing to
the ODBC data source
define an ODBC library in SAS metadata that
references the ODBC server
define metadata for ODBC tables from the ODBC
library

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

ODBC Registration in SAS


Registering metadata for ODBC data sources in
SAS includes the following:
a database server definition that references the data
source name (DSN) that is registered to the operating
system
a library definition that uses the ODBC engine and
references an ODBC database server definition

25

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-35

Registering Metadata for ODBC Data Sources

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.

Verifying the ODBC System Data Sources


The ODBC Data Source Administrator is used to verify the existence of two Microsoft Access databases
as ODBC system data sources.
1. Access the ODBC Data Source Administrator.
a. Select Start Control Panel System and Security Administrative Tools.
b. Double-click Data Sources (ODBC). The ODBC Data Source Administrator window appears.

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

d. Verify that the database source is D:\WORKSHOP\DIFT\DATA\OrionStarContacts.mdb.

e. Click Cancel to close the ODBC Microsoft Access Setup window.


f. On the System DSN tab, click the Orion Star Orders data source.
g. Click Configure to open the ODBC Microsoft Access Setup window.
h. Verify that the database source is D:\WORKSHOP\DIFT\DATA\OrionStarOrders.mdb.

i. Click Cancel to close the ODBC Microsoft Access Setup window.


j. Click Cancel to close the ODBC Data Source Administrator window.
3. Click to close the Administrative Tools window.
4. Click to close the System and Security window.

Verifying the ODBC Database Server Definition


1. Access SAS Management Console with Ahmed’s credentials.
a. Select Start All Programs SAS SAS Management Console 9.4.
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 Ahmed in the User ID field and Student1 in the Password field.
e. Click OK to close the Log On window. SAS Management Console appears.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-37

2. If necessary, click the Plug-ins tab.


3. Click to expand the Server Manager plug-in.
4. Click the server definition named DIFT ODBC Microsoft Access Server.
5. On the Connections tab, right-click the connection named Orion Star Contacts and select
Properties.

a. Click the Options tab.


b. Verify that Datasrc is selected.
c. Verify that "Orion Star Contacts" is specified in the Datasrc field.

Quotation marks are needed if the Datasrc value contains blanks.


d. Click Cancel to close the Connection: Orion Star Contacts Properties window.
6. On the Connections tab, right-click the connection named Orion Star Orders and select Properties.
a. Click the Options tab.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-38 Chapter 3 Creating Metadata for Source Data

b. Verify that Datasrc is selected.


c. Verify that "Orion Star Orders" is specified in the Datasrc field.

d. Click Cancel to close the Connection: Orion Star Orders Properties window.
7. Select File Exit to close SAS Management Console.

Defining Metadata for an ODBC Data Source Library


Because the needed ODBC database server is defined, Kari can define the metadata object that represents
a library for the desired ODBC data source.
1. If necessary, access SAS Data Integration Studio with Kari’s credentials.
a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Select Kari’s 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 Library. The New Library Wizard appears.
6. If necessary, expand Database Data folder.
7. Click ODBC Library.
8. Click Next.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-39

9. Enter DIFT ODBC Contacts Library in the Name field.


10. Verify that the location is set to /Data Mart Development/Orion Source Data.

11. Click Next.


12. Double-click SASApp in the Available servers list box to move it to the Selected servers list box.
13. Click Next.
14. Enter odbccont in the Libref field.

15. Click Next.


16. Select DIFT ODBC Microsoft Access Server in the Database Server field.
17. Select Connection: Orion Star Contacts in the Connection field.

No login is needed for this connection.


18. Click Next.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-40 Chapter 3 Creating Metadata for Source Data

The review window shows the following:

19. Click Finish.

The DIFT ODBC Contacts Library is on the Checkouts tab.

Defining Metadata for a Microsoft Access Table


With the ODBC library defined, Kari can easily define the metadata object that references a table in the
Microsoft Access database.
1. If necessary, access SAS Data Integration Studio with Kari’s credentials.
2. Click the Checkouts tab.
3. Select DIFT ODBC Contacts Library.
4. Select File Register Tables. The Register Tables Wizard appears.

6. Verify that the SAS library is DIFT ODBC Contacts Library.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-41

7. Verify that the data source is "Orion Star Contacts".


8. Click Next.
9. Select the CustType table.
10. Verify that the location is set to /Data Mart Development/Orion Source Data.

11. Click Next.


The review window shows the following:

12. Click Finish.

The CustType table object is on the Checkouts tab.


28. Right-click the CustType metadata table object and select Properties.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-42 Chapter 3 Creating Metadata for Source Data

29. Enter DIFT Customer Types in the Name field.

30. Click the Columns tab to view the registered column properties.

Column properties were retrieved from the database.


31. Click the Physical Storage tab.

Notice that the physical table name is CustType.


32. Click OK to close the Properties window.

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.

34. Select File Close to close the View Data window.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-44 Chapter 3 Creating Metadata for Source Data

About External Files


An external file has these characteristics:
sometimes referred to as a flat file or a raw data file
character-based (for example, ASCII or EBCDIC)
often uses one line per record
The fields in an external file
can have fixed widths
can be separated by a delimiter (for example, comma,
tab, or blank).

27

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-45

Registering Metadata for an External File

This demonstration illustrates registering metadata for a comma-delimited external file that contains
supplier information.
1. If necessary, access SAS Data Integration Studio with Kari’s credentials.
a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Select Kari’s 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.

8. Click Next. The External File Location window appears.


9. Click Browse to open the Select a file window.
10. Navigate to D:\Workshop\dift\data.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-46 Chapter 3 Creating Metadata for Source Data

11. Change the Type field to Delimited Files (*.csv).


12. Select supplier.csv.

13. Click OK.


14. To view the contents of the external file, click Preview.

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:

16. Click Next. The Delimiters and Parameters window appears.


17. Clear the Blank check box.
18. Select the Comma check box.

19. Click Next. The Column Definitions window appears.


20. Click Refresh in the lower pane to see the first 10 records in the external file.

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.

23. Click OK to close the Auto Fill Columns window.


The upper pane of the Column Definitions window is populated with six column definitions: three
numeric and three character values.

24. Click Import. The Import Column Definitions window appears.

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.

28. Provide the following descriptions:

Column Name Description

Supplier_ID Supplier ID

Supplier_Name Supplier Name

Street_ID Supplier Street ID

Supplier_Address Supplier Address

Sup_Street_Number Supplier Street Number

Country Supplier Country

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-50 Chapter 3 Creating Metadata for Source Data

29. Change the length of Supplier_ID to 4.

30. Click the Data tab in the bottom pane of the Column Definitions window.
31. Click Refresh.

32. Click Next.


The review window shows the following:

33. Click Finish.


The metadata object for the external file is found in the Checkouts tree.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-51

Checking in the Metadata Objects


1. Verify that no objects are selected in the Checkouts tree.
2. Select Check Outs Check In All.
3. Enter Adding source data metadata objects in the Title field.
4. Enter Checking in one SAS table, two Oracle tables, one MS Access db table, and one external
file. Also two libraries… in the Description field.

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

The objects should no longer be in the Checkouts tree.

10. Click the Folders tab.


11. Expand Data Mart Development Orion Source Data.
12. Verify that all objects are now checked in. There should be a total of nine metadata objects in the
Orion Source Data folder.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.2 Registering Source Data Metadata 3-53

Exercises

5. Defining Metadata for Additional SAS Source Tables


Register additional SAS source tables in the metadata. These tables are found in two separate
libraries.
 Place all metadata table objects in the Data Mart Development Orion Source Data folder.
 Register one additional table found in the DIFT Orion Source Tables Library.
 Add the prefix DIFT to the default metadata name table.

Physical Table Metadata Table Name

STAFF DIFT STAFF


 Register the following tables found in the DIFT SAS Library. (This library was defined in
Exercise 3.)
 Add the prefix DIFT to the default metadata name of each table.

Physical Table Metadata Table Name

NEWORDERTRANS DIFT NEWORDERTRANS

PROFIT DIFT PROFIT

STAFF_PARTIAL DIFT STAFF_PARTIAL

VALIDPRODUSAOUTDOOR DIFT VALIDPRODUSAOUTDOOR


 Remove any descriptions.
 Check in all table objects.

6. Defining Metadata for Tables in a Microsoft Access database


Register tables from a Microsoft Access database. The library was defined in the demonstration in
this chapter and one of three tables in the database was registered. Register metadata for the two
remaining tables in the database.
 Place the metadata table objects in the Data Mart Development Orion Source Data folder.
 Use the DIFT ODBC Contacts Library.
 Verify that the two tables are Contacts and NewProducts.
 Add the prefix DIFT to the default metadata name of each table.
 Check in all the tables.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-54 Chapter 3 Creating Metadata for Source Data

7. Defining Metadata for an External File


A file, named profit.txt that is located in the directory D:\Workshop\dift\data, is needed for
processing. Therefore, the file must be defined in the metadata. The fields in this file have fixed
column widths, so the appropriate wizard to use is the New Fixed Width External File Wizard.
 Name the metadata object representing the external file DIFT Profit Information.
 Place the metadata object in the /Data Mart Development/Orion Source Data folder.
 Assign the following column properties:

Column Begin End


Name Length Type Informat Format Position Position

Company 30 Char $22. 1 22

YYMM 8 Num yymm5. 24 28

Sales 8 Num dollar13. 30 43

Cost 8 Num dollar13. 45 58

Salaries 8 Num dollar13. 61 84

Profit 8 Num dollar13. 87 100

Columns can be created by clicking New.

Ignore the warning about missing informats.


 Check in the external file metadata object.

8. Defining Metadata for an Additional Microsoft Access Database


Orion Star is considering the purchase of a small store that sells various products over the Internet and
through catalog orders. Some data from the store was made available for analysis in the form of a
Microsoft Access database. Create the necessary metadata objects for the tables in this database.
 Create a library metadata definition.
 Name the library DIFT ODBC Orders Library.
 Place the library object in the /Data Mart Development/Orion Source Data folder.
 Use odbcordr as the library reference.
 Use the DIFT ODBC Microsoft Access Server and the Orion Star Orders connection.
 Register metadata for the three tables in the DIFT ODBC Orders Library.
 Register the three tables: Catalog_Orders, PRODUCTS, Web_Orders.
 Place the table objects in the Data Mart Development Orion Source Data folder.
 Add the prefix DIFT to the default metadata name of each table.
 View the data for each of the three tables.
 Check in all objects.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.3 Solutions to Exercises 3-55

3.3 Solutions to Exercises


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
a. If necessary, access SAS Data Integration Studio with Kari’s credentials.
1) Select Start All Programs SAS SAS Data Integration Studio 4.8.
2) Select Kari’s Work Repository as the connection profile.
3) Click OK to close the Connection Profile window and open the Log On window.
4) Enter Kari in the User ID field and Student1 in the Password field.
5) Click OK to close the Log On window.
b. Click the Folders tab.
1) Expand Data Mart Development Orion Source Data.
2) Verify that the Orion Source Data folder is selected.
c. Select File New Library. The New Library Wizard appears.
1) Click SAS BASE Library as the type of library.
2) Click Next.
d. Enter DIFT SAS Library in the Name field.
1) Verify that the location is set to \Data Mart Development\Orion Source Data.
2) Click Next.
e. Click SASApp in the Available servers pane.
1) Click to move SASApp to the Selected servers list box.
2) Click Next.
f. Enter diftsas in the Libref field.
1) The desired path does not exist in the Available items pane. Click New.
2) In the New Path Specification window, click Browse next to Paths.
3) In the Browse window, navigate to D:\Workshop\dift.
4) Click the data folder to select it.
5) Click OK to close the Browse window.
6) Verify that the value in the Paths field is D:\Workshop\dift\data.
7) Click OK to close the New Path Specification window.

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. Checking in New Library Objects


a. Click the Checkouts tab.
1) Select Check Outs Check In All.
2) Enter Adding two library objects in the Title field.
3) Enter Checking in new library objects of DIFT Orion Source Tables Library and DIFT
SAS Library in the Description field.

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

The library objects should no longer be in the Checkouts tree.

d. Click the Folders tab.


e. Expand Data Mart Development Orion Source Data.

f. Verify that both library objects are now checked in.

5. Defining Metadata for Additional SAS Source Tables


a. Register an additional table found in DIFT Orion Source Tables 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 select DIFT Orion Source Tables
Library.
8) Click Next. The Define Tables and Select Folder Location window appears.
9) Select STAFF.
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.
b. Update the properties of the new table object.
1) Click the Checkouts tab.
2) Right-click the STAFF metadata table object and select Properties.
3) Enter DIFT at the beginning of the default name.
4) Click OK to close the Properties window.

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.

e. Check in all SAS tables.


1) Select Check Outs Check In All.
2) Enter Adding metadata for SAS source tables in the Title field.
3) Enter Added metadata for SAS tables found in DIFT SAS Library and in DIFT Orion
Source Tables Library. in the Description field.
4) Click Next. Verify that all table objects are selected.
5) Click Next. Review the information in the Summary window.
6) Click Finish. The table objects should no longer be in the Checkouts tree.

6. Defining Metadata for Tables in a Microsoft Access database


a. Register two additional tables that are found in the DIFT ODBC Contacts Library.
1) Click the Folders tab.
2) Expand Data Mart Development Orion Source Data.
3) Select DIFT ODBC Contacts Library.
4) Select File Register Tables. The Register Tables Wizard appears for the DIFT ODBC
Contacts Library.
5) Click Next.
6) Select Contacts, hold down the Ctrl key, and select NewProducts.
7) Click Next.
8) Click Finish.
The metadata objects are found in the Checkouts tree.

b. Update the properties of the new table objects.


1) Right-click the Contacts metadata table object and select Properties.
2) Enter DIFT at the beginning of the default name.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-60 Chapter 3 Creating Metadata for Source Data

3) Click OK to close the Properties window.


4) Right-click the NewProducts metadata table object and select Properties.
5) Enter DIFT at the beginning of the default name.

6) Click OK to close the Properties window.


c. Check in all the tables.
1) Select Check Outs Check In All.
2) Enter Adding metadata for Contacts and NewProducts tables in the Title field.
3) Click Next. Verify that all table objects are selected.
4) Click Next. Review the information in the Summary window.
5) Click Finish. The table objects should no longer be in the Checkouts tree.
7. Defining Metadata for an External File
a. Click the Folders tab.
1) Expand Data Mart Development Orion Source Data.
2) Verify that the Orion Source Data folder is selected.
b. Select File New External File Fixed Width.
1) Enter DIFT Profit Information in the Name field.
2) Verify that the location is set to /Data Mart Development/Orion Source Data.
3) Click Next. The External File Location window appears.
c. Click Browse to open the Select a file window.
1) Navigate to D:\Workshop\dift\data.
2) Select profit.txt.
3) Click OK.
d. To view the contents of the external file, click Preview.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3.3 Solutions to Exercises 3-61

1) Click OK to close the Preview File window.


2) Click Next. The Parameters window appears.
e. Accept the default settings for the parameters and click Next.
f. Define the column information. For each column, click New to add a new column and enter the
following column properties:

Column Begin End


Name Length Type Informat Format Position Position

Company 22 Char $22. 1 22

YYMM 8 Num yymm5. 24 28

Sales 8 Num dollar13. 30 43

Cost 8 Num dollar13. 45 58

Salaries 8 Num dollar13. 61 84

Profit 8 Num dollar13. 87 100

g. Click the Data tab and then click Refresh.


A warning window appears.

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

8. Defining Metadata for an additional Microsoft Access database


a. Register the library for the workshop Microsoft Access database.
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 New Library. The New Library wizard appears.
5) Select ODBC Library as the type of library.
6) Click Next.
7) Enter DIFT ODBC Orders Library in the Name field.
8) Verify that the location is set to /Data Mart Development/Orion Source Data.
9) Click Next.
10) Double-click SASApp in the Available servers list box to move it to the Selected servers list box.
11) Click Next.
12) Enter odbcordr in the Libref field.
13) Click Next.
14) Verify that the Database Server is the DIFT ODBC Microsoft Access Server.
15) Select Connection: Orion Star Orders in the Connection field.
(Verify that you did not select Connection: Orion Star Contacts.)
16) Click Next. Review the summary information.
17) Click Finish. This finishes the metadata definition for the library object.
b. Register the tables found in the DIFT ODBC Orders Library.
1) Click the Checkouts tab.
2) Right-click the DIFT ODBC Orders Library and select Register Tables. The Register
Tables Wizard appears for the DIFT ODBC Orders Library.
3) Click Next.
4) Click Select All Tables to select the three available tables: Catalog_Orders, PRODUCTS,
and Web_Orders.
5) Verify that the location is set to /Data Mart Development/Orion Source Data.
6) Click Next.
7) Click Finish. The metadata objects for the three tables as well as the newly defined library
object are found in the Checkouts tree.
c. If necessary, click the Checkouts tab.
d. Update the metadata for Catalog_Orders.
1) Right-click the Catalog_Orders metadata table object and select Properties.
2) Enter DIFT Catalog_Orders in the Name field.
3) 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-63

e. Update the metadata for PRODUCTS.


1) Right-click the PRODUCTS metadata table object and select Properties.
2) Enter DIFT PRODUCTS in the Name field.
3) Click OK to close the Properties window.
f. Update the metadata for Web_Orders.
1) Right-click the Web_Orders metadata table object and select Properties.
2) Enter DIFT Web_Orders in the Name field.
3) Click OK to close the Properties window.
g. Check in the metadata objects.
1) Verify that no objects are selected in the Checkouts tree.
2) Select Check Outs Check In All.
3) Enter Adding table and library metadata for Microsoft Access tables in the Title field.
4) Click Next.
5) Verify that all objects are selected.
6) Click Next. Review the information in the Summary window.
7) Click Finish.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
3-64 Chapter 3 Creating Metadata for Source Data

h. Click the Folders tab.


1) Expand Data Mart Development Orion Source Data.
2) Verify that the Orion Source Data folder resembles the following:

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

4.2 Importing Metadata ...................................................................................................... 4-15


Demonstration: Importing Relational Metadata ................................................................... 4-18

4.3 Solutions to Exercises ................................................................................................. 4-24


4-2 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-3

4.1 Registering Target Data Metadata

Objectives
Review features of the New Table Wizard.
Use the New Table Wizard to register metadata for
target tables.

New Table Wizard


New Table Used to define metadata for a new table
Wizard

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

Case Study Scenario


The star schema that you are working toward has four
dimension tables and one fact table.

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

Product Dimension Table Diagram


A sketch of the process for Product
the Product Dimension Dimension
table was made earlier. Computed
The source tables were Columns
registered in a previous Product_Category
step. The next Product_Group
demonstration illustrates Product_Line
defining metadata for
the target table.

Product_List Supplier Information

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

Defining the Product Dimension Table Metadata

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 Kari’s credentials.
a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Select Kari’s 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.

5. Select File New Table. The New Table Wizard appears.


6. Enter DIFT Product Dimension in the Name field.
7. Verify that the location is set to /Data Mart Development/Orion Target Data.

8. Click Next.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.1 Registering Target Data Metadata 4-7

9. Verify that the DBMS field is set to SAS.


10. Click New next to the Library field.

The New Library Wizard appears.


11. Specify metadata for the new library object.
a. Enter DIFT Orion Target Tables Library in the Name field.
b. Click Browse next to the Location field. The Select a Location window appears.
1) Click in the Look in field and select the SAS Folders folder.

2) Double-click the Data Mart Development folder.


3) Double-click the Orion Target Data folder.
4) Click OK.
5) Verify that the location is set to /Data Mart Development/Orion Target Data.

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

a) In the New Path Specification window, click Browse next to Paths.


b) In the Browse window, navigate to D:\Workshop\dift.

c) Click to add a new folder.


d) Enter datamart as the name of the new folder and press Enter.
e) Click the datamart folder to select it.
f) Click OK to close the Browse window.
The New Path Specification window displays the newly defined path.

g) Click OK to close the New Path Specification window.


3) Verify that the newly specified path is found in the Selected items list box.

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.

14. Click Next. The Select Columns window appears.


15. Expand the Data Mart Development Orion Source Data folder on the Folders tab.
16. From the Orion Source Data folder, expand the DIFT PRODUCT_LIST table object.

17. Select Product_ID, Product_Name, and Supplier_ID from DIFT PRODUCT_LIST. Click
to move the columns to the Selected list box.

18. Expand the DIFT Supplier Information external file object.

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

20. Click Next.


The Change Columns/Indexes window appears.

21. Update the column metadata.


a. Update the name for the Country column to Supplier_Country.
b. Verify that the length of Supplier_ID is 4.
22. Select the last column (Supplier_Name).
23. Add metadata for three new columns.
a. For each column, click New to define column properties.
b. Enter the following information for the new columns:

Column Name Description Length Type

Product_Category Product Category 25 Character

Product_Group Product Group 25 Character

Product_Line Product Line 25 Character

The final set of eight columns is shown below.

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

26. Review the metadata listed in the summary window.

27. Click Finish.


The new table object and the new library object appear in the Checkouts tree.
28. If necessary, click the Checkouts tab.
29. Select Check Outs Check In All.
a. Enter Adding metadata for Product Dimension table in the Title field.
b. Enter DIFT Orion Target Tables Library object was also created and checked in in the
Description field.
c. Click Next. Verify that both objects are selected.
d. Click Next. Review the information in the Summary window.
e. Click Finish.
30. Click the Folders tab.
31. Verify that the new table and new library objects appear in the Orion Target Data folder.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.1 Registering Target Data Metadata 4-13

Exercises

1. Defining the DIFT Order Fact Target Table


A new target table that contains order information must be defined in the metadata.
 Name the metadata object DIFT Order Fact.
 Store the metadata object in the Orion Target Data folder under Data Mart Development.
 Specify that the table should be created as a SAS table with the physical name of OrderFact.
 Physically store the table in DIFT Orion Target Tables Library.
 Use the set of distinct columns from DIFT ORDER_ITEM and DIFT ORDERS.
 Update the column attributes as follows:

Name Description Informat Format

ORDER_ID Order ID (None) 12.

ORDER_ITEM_NUM Order Item Number (None) (None)

PRODUCT_ID Product ID (None) 12.

QUANTITY Quantity Ordered (None) (None)

TOTAL_RETAIL_PRICE Total Retail Price (None) DOLLAR12.

COSTPRICE_PER_UNIT Cost Price Per Unit (None) DOLLAR12.

DISCOUNT Discount % (None) PERCENT.

ORDER_TYPE Order Type (None) ORDER_TYPE.

EMPLOYEE_ID Employee ID (None) 12.

CUSTOMER_ID Customer_ID (None) 12.

OrderDate Date Order was Placed (None) DATE9.


New name for ORDER_DATE

DeliveryDate Date Order was Delivered (None) DATE9.


New name for DELIVERY_DATE

Notice the new names for ORDER_DATE and DELIVERY_DATE.


 Check in the new table object.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-14 Chapter 4 Creating Metadata for Target Data

2. Defining Additional Target Tables


Several additional tables must be defined for the demonstrations and exercises in subsequent sections.
a. Create a new metadata table object named DIFT Old Orders.
 Name the metadata table object DIFT Old Orders.
 Store the metadata object in the Orion Target Data folder under Data Mart Development.
 Specify that the table should be created as a SAS table that is stored in DIFT Orion Target
Tables Library with a physical name of Old_Orders.
 The columns in Old_Orders should be the same columns that are defined in the DIFT
Order Fact target table.
b. Create a new metadata table object named DIFT Recent Orders.
 Name the metadata table object DIFT Recent Orders.
 Store the metadata object in the Orion Target Data folder under Data Mart Development.
 Specify that the table should be created as a SAS table that is stored in DIFT Orion Target
Tables Library with a physical name of Recent_Orders.
 The columns in Recent_Orders should be the same columns that are defined in the DIFT
Order Fact target table.
c. Create a new metadata table object named DIFT US Suppliers.
 Name the metadata table object DIFT US Suppliers.
 Store the metadata object in the Orion Target Data folder under Data Mart Development.
 Specify that the table should be created as a SAS table that is stored in DIFT Orion Target
Tables Library with a physical name of US_Suppliers.
 The columns in US_Suppliers should be the same columns that are defined in the DIFT
Supplier Information external file object.
d. Check in all of the metadata table objects.
e. Verify that the new metadata table objects appear in the correct folder on the Folders tab.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.2 Importing Metadata 4-15

4.2 Importing Metadata

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

Supported Metadata File Formats


SAS Data Integration Studio enables you to export and
import metadata.
Two metadata formats are supported.
SAS metadata in the SAS package format
relational metadata in the Common Warehouse
Metamodel (CWM) format

15

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-16 Chapter 4 Creating Metadata for Target Data

Metadata File Formats


The SAS package format
is a SAS internal format
supports most SAS platform metadata objects
including objects relevant to SAS Data Integration
Studio, such as jobs, libraries, tables, and external
files.
The Common Warehouse Metamodel (CWM)
is an industry standard format
is supported by many software vendors
supports relational metadata such as tables, columns,
indexes, and keys.

16

Uses of Metadata File Formats


The SAS package format can be used to
move metadata between SAS metadata repositories
move metadata between environments such as from
development to test and test to production
maintain backups of metadata
keep archived versions of metadata objects.
The CWM format can be used to
exchange relational metadata between software
applications
import models from third-party data modeling tools
into SAS Data Integration Studio.

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

Importing Relational Metadata

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 Bruno’s 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

8. Specify a valid XML file.


a. Click Browse next to the Filename field to open the Select a file window.
b. Navigate to D:\Workshop\dift\data.
c. Select OracleWarehouseBuilder.xml.
d. Click OK to close the Select a file window.
9. Verify that the folder location is set to /Data Mart Development/Orion Target Data.

10. Click Next.


11. Review (and accept) the default Meta Integration Options.

12. Click Next.


13. Verify that Import as new metadata is selected.

14. Click Next. The Metadata Location window appears.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-20 Chapter 4 Creating Metadata for Target Data

15. Specify a library.

a. Click in the Library field to assign a new library location.


b. On the Folders tab, navigate to Data Mart Development Orion Target Data.
c. Click DIFT Orion Target Tables Library.
d. Click OK to close the Select a library window.

16. Click Next.


17. Review and accept the final settings.

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

19. Click No.


The Folders tab displays two new metadata table objects in the Orion Target Data folder.

20. Update the properties for the CURRENT_STAFF table object.


a. Right-click the CURRENT_STAFF metadata table object and select Properties.
b. Enter DIFT Current Staff in the Name field.

c. Click the Columns tab to view the imported column properties.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-22 Chapter 4 Creating Metadata for Target Data

d. Update the formats for each of the columns.

Name Informat Format

EMPLOYEE_ID (None) 12.

START_DATE (None) DATE9.

END_DATE (None) DATE9.

JOB_TITLE (None) (None)

SALARY (None) DOLLAR12.

GENDER (None) $GENDER.

BIRTH_DATE (None) DATE9.

EMP_HIRE_DATE (None) DATE9.

EMP_TERM_DATE (None) DATE9.

MANAGER_ID (None) 12.

The Columns tab should resemble the following:

e. Select the column of formats.


1) Click the first format cell.
2) Hold down the Shift key and click the last format cell. The column of formats is now
selected.
3) Hold down the Ctrl key and press C to copy the selection to the clipboard. It can be pasted in
a subsequent step.
f. Click OK to close the Properties window.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4.2 Importing Metadata 4-23

21. Update properties for the TERM_STAFF table object.


a. Right-click the TERM_STAFF metadata table object and select Properties.
b. Enter DIFT Terminated Staff in the Name field.

c. Click the Columns tab to view the imported column properties.


d. Update the formats.
1) Click the first format cell
2) Hold down the Ctrl key and press V to paste the column of formats that was copied in a
previous step.

e. Click OK to close the Properties window.


The metadata objects in the Orion Target Data folder should now resemble the following:

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-24 Chapter 4 Creating Metadata for Target Data

4.3 Solutions to Exercises


1. Defining the DIFT Order Fact Target Table
a. If necessary, access SAS Data Integration Studio with Kari’s credentials.
1) Select Start All Programs SAS SAS Data Integration Studio 4.8.
2) Select Kari’s Work Repository as the connection profile.
3) Click OK to close the Connection Profile window and open the Log On window.
4) Enter Kari in the User ID field and Student1 in the Password field.
5) Click OK to close the Log On window.
b. Click the Folders tab.
c. Expand Data Mart Development Orion Target Data.
d. Verify that the Orion Target Data folder is selected.
e. Select File New Table. The New Table Wizard appears.
1) Enter DIFT Order Fact in the Name field.
2) Verify that the location is set to /Data Mart Development/Orion Target Data.
3) Click Next.
4) Verify that the DBMS field is set to SAS.
5) Select DIFT Orion Target Tables Library as the value for the Library field.
6) Enter OrderFact in the Name field.
7) Click Next.
f. Expand the Data Mart Development Orion Source Data folder on the Folders tab.
1) Select the DIFT ORDER_ITEM table object.

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

g. Update the column attributes as follows:

Name Description Informat Format

ORDER_ID Order ID (None) 12.

ORDER_ITEM_NUM Order Item Number (None) (None)

PRODUCT_ID Product ID (None) 12.

QUANTITY Quantity Ordered (None) (None)

TOTAL_RETAIL_PRICE Total Retail Price (None) DOLLAR12.

COSTPRICE_PER_UNIT Cost Price Per Unit (None) DOLLAR12.

DISCOUNT Discount % (None) PERCENT.

ORDER_TYPE Order Type (None) ORDER_TYPE.

EMPLOYEE_ID Employee ID (None) 12.

CUSTOMER_ID Customer_ID (None) 12.

OrderDate Date Order was Placed (None) DATE9.


New name for ORDER_DATE

DeliveryDate Date Order was Delivered (None) DATE9.


New name for DELIVERY_DATE

Notice the new names for ORDER_DATE and DELIVERY_DATE.


h. Click Next.
i. Review the metadata listed in the summary window.
j. Click Finish.
The new table object appears in the Checkouts tree.
k. Click the Checkouts tab.
1) Select Check Outs Check In All.
2) Enter Adding metadata for Order Fact table in the Title field.
3) Click Next. Verify that the table object is selected.
4) Click Next. Review the information in the Summary window.
l. Click Finish. The table object should no longer be on the Checkouts tab.

2. Defining Additional Target Tables


a. Define metadata for the DIFT Old 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

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
4-26 Chapter 4 Creating Metadata for Target Data

4) Select File New Table. The New Table Wizard appears.


5) Enter DIFT Old 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 Old_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.
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

5.2 Using the Join Transformation .................................................................................... 5-23


Demonstration: Populating the Product Dimension Table ................................................... 5-30
Exercises .............................................................................................................................. 5-49

5.3 Solutions to Exercises ................................................................................................. 5-50


5-2 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-3

5.1 Introduction to Jobs and the Job Editor

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

Populating the Current and Terminated Staff Tables

This demonstration shows the building of a job that uses the Splitter transformation.
The final process flow diagram resembles the following:

1. If necessary, access SAS Data Integration Studio with Kari’s credentials.


a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Select Kari’s Work Repository as the connection profile.
c. Click OK to close the Connection Profile window and access 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 Jobs.
4. Verify that the Orion Jobs folder is selected.
5. Select File New Job. The New Job window appears.
6. Enter DIFT Populate Current and Terminated Staff Tables in the Name field.
7. Verify that the location is set to /Data Mart Development/Orion Jobs.

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

The Job Editor window appears

9. Add the source data object to the process flow.


a. If necessary, click the Folders tab.
b. Expand Data Mart Development Orion Source Data.
c. Drag the DIFT STAFF table object to the Diagram tab of the Job Editor.

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

11. Add the Splitter transformation to the diagram.


a. In the tree view, click the Transformations tab.
b. Expand the Data grouping.
c. Click the Splitter transformation.

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

13. Connect the source table object to the Splitter transformation.


a. Place the cursor over the DIFT STAFF table object. A connection selector appears.

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.

e. Arrange the table objects so that they are separated.

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

The resulting process flow diagram should resemble the following:

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.

b. Click the Row Selection tab.


c. Specify the subsetting criteria for the DIFT Current Staff table object.
1) Verify that the DIFT Current 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.

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.1 Introduction to Jobs and the Job Editor 5-13

4) Click the Data Sources tab.


5) Expand the STAFF table.
6) Select the Emp_Term_Date column.
7) Click Add to Expression.

8) Click in the operators area.

9) Enter . (a period for a missing numeric value).


The Expression Text area should now resemble the following:

10) Click OK to close the Expression Builder window.

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-14 Chapter 5 Creating Metadata for Jobs

The Row Selection tab is updated to the following:

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.

8) Click in the operators area.

9) Enter . (a period for a missing numeric value).


10) Click OK to close the Expression Builder window.
The Row Selection tab is updated to the following:

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.1 Introduction to Jobs and the Job Editor 5-15

e. Click the Mappings tab.


f. Verify that all target table columns have a mapping (incoming arrow).

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.

22. Click on the Details pane to close the Details pane.


23. Click the Log tab to view the log for the executed job.
24. Scroll to view the note about the creation of the DIFTTGT.CURRENT_STAFF table.

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

Status Displays the completion status of each step


Warnings and Errors Displays warnings and errors
Statistics Displays run-time and table statistics
Control Flow Is used to review and update the execution sequence of the steps in a job
Columns Is used to review and update column properties in a table
Is available when a table is selected
Mappings Is used to review and update column mappings across a transformation
Is available when a transformation is selected

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

5.2 Using the Join Transformation

Objectives
Discuss components of the Join transformation’s
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

The Join Designer’s initial view includes the following:


 Main display area with Diagram tab, Code tab, and Log tab
 Navigate pane - navigate the current query
 SQL Clauses pane - add SQL clauses or edit the join type
 Properties pane - view and edit properties of a selected item

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

The Product_Group, Product_Category, and Product_Line are encoded in the Product_ID.

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.

Expressions for the Calculated Columns


The calculations for the three columns can be done as
follows:
Product_Group:
put(int(product_id/100000)*100000,product.)

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

The value 1e5 is shorthand notation for 100,000.

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-30 Chapter 5 Creating Metadata for Jobs

Populating the Product Dimension Table

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:

1. If necessary, access SAS Data Integration Studio with Kari’s credentials.


a. Select Start All Programs SAS SAS Data Integration Studio 4.8.
b. Select Kari’s Work Repository as the connection profile.
c. Click OK to close the Connection Profile window and access 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 Jobs.
4. Verify that the Orion Jobs folder is selected.
5. Select File New Job. The New Job window appears.
a. Enter DIFT Populate Product Dimension Table in the Name field.
b. Verify that the location is set to /Data Mart Development/Orion Jobs.
c. Click OK. The Job Editor window appears.

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-31

6. Add the source data objects to the process flow.


a. If necessary, from the Folders tab, expand Data Mart Development Orion Source Data.
b. Click the DIFT PRODUCT_LIST table object. Hold down the Ctrl key and also select the DIFT
Supplier Information external file object.
c. Drag the objects to the Diagram tab of the Job Editor.

d. Arrange the source data objects so that they are separated.

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

8. Add the File Reader transformation to the diagram.


a. In the tree view, click the Transformations tab.
b. Expand the Access grouping.
c. Click the File Reader transformation.

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.

f. Connect DIFT Supplier Information to the File Reader transformation.

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

c. Enter FileReader in the Physical name field.

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

The diagram is updated to the following:

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.

The Table Selector window appears.

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-36 Chapter 5 Creating Metadata for Jobs

b. Verify that the Folders tab is selected.


c. Expand the Data Mart Development Orion Target Data folders.
d. Select the DIFT Product Dimension table object.

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

d. Click OK to close the File Reader Properties window.


18. Select File Save to save the diagram and job metadata to this point.
19. Specify the properties of the Join transformation.
a. Right-click the Join transformation and select Open. The Designer window appears.

The Designer window’s initial view includes the following:


 The Diagram tab in the main pane displays the current query in the form of a process flow
diagram. The name of this tab changes to match the object selected in the Navigate pane.
 The Navigate pane is used to access the components of the current query.
 The SQL Clauses pane is used to add SQL clauses or additional joins to the query.
 The Properties pane is used to display and update the properties of a selected item.

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-38 Chapter 5 Creating Metadata for Jobs

b. Click the Join item (single-click) on the Diagram tab.


c. In the Join Properties pane, verify that the join type is an Inner join.

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.

The Choose Columns window appears.


3) Expand DIFT PRODUCT_LIST.
4) Click Product_Level.

5) Click OK to close the Choose Columns window.


6) Enter the numeral 1 for the second Operand field and press Enter.

The SQL WHERE clause is updated to the following:

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.

Notice that four of the target columns are not mapped.


h. Map the Country column to Supplier_Country by clicking on the Country column in the
Source table area and dragging it to Supplier_Country in the Target table area.

The three columns that are to be calculated remain unmapped.

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.

An expression must be defined for three columns.

j. Reorder the columns in this order: Product_Group, Product_Category, Product_Line.


As Kari, in order to perform the column reordering for the target table (a change in
metadata for the target table), the target table must be checked out. To check out the
table object, the open job that uses the table must be closed.
1) Select File Save to save the diagram and job metadata to this point.
2) Select File Close to close the job.
3) Click the Folders tab.
4) Expand the Data Mart Development Orion Target Data folders.
5) Right-click DIFT Product Dimension and select Check out.
6) Click the Checkouts tab.
7) Right-click DIFT Product Dimension and select Properties.
8) Click the Columns tab.
9) Reorder the columns. Click on the column number and dragging it to the correct location.

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

The Expression window appears.

3) Locate and open the HelperFile.txt file in D:\Workshop\dift.


4) Copy the expression for Product_Group.

5) Paste the copied expression in the Expression Text area.

6) Click Validate Expression.

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

1) If necessary, access the HelperFile.txt file in D:\Workshop\dift.


2) Copy the expression for Product_Category.

3) In SAS Data Integration Studio, click the Expression field for the Product_Category
column.
4) Hold down the Ctrl key and type v to paste the copied expression in the Expression field.
m. Specify an expression for Product_Line.
1) If necessary, access the HelperFile.txt file in D:\Workshop\dift.
2) Copy the expression for Product_Line.

3) In SAS Data Integration Studio, click the Expression field for the Product_Line column.
4) Hold down the Ctrl key and type v to paste the copied expression in the Expression field.
The final settings for the calculated columns are as follows:

n. Click to collapse the target table area back to the right.


o. Verify that each of the calculated columns do not have an established source column mapping.

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-46 Chapter 5 Creating Metadata for Jobs

p. Fix the warnings.


1) Verify that each of the calculated fields now has an associated warning symbol.

2) Click the column Product_Group.

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.

q. Select File Save to save changes to the Join transformation.


r. Click to return to the Job Editor.
20. Verify that the final process flow resembles the following:

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-47

21. Click in the job toolbar.


22. Verify that the job completes successfully.

23. View the log for the executed job.


a. Click the Log tab.
b. Scroll to view the note about the creation of the DIFTTGT.PRODDIM table.

24. View the data for the target table.


a. Click the Diagram tab.
b. Right-click the DIFT Product Dimension table and select Open.
c. Scroll to the new columns and verify that the data was calculated properly.

d. Select File Close to close the View Data window.


25. Select File Close to close the Job Editor window. The new job object appears on the
Checkouts tab.

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-48 Chapter 5 Creating Metadata for Jobs

26. Check in the job.


a. Click the Checkouts tab in the tree view.
b. Select Check Outs Check In All.
c. Enter Adding job that populates product dimension table in the Title field.
d. Enter Also adding updated product dimension table in the Description field.
e. Click Next. Verify that the job and table objects are selected.
f. Click Next. Review the information in the Summary window.
g. Click Finish. The job and table objects should no longer be on the Checkouts tab.

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.2 Using the Join Transformation 5-49

Exercises

1. Loading the OrderFact Table


Some specifics for creating the job to load the OrderFact table are shown below.
 Name the job DIFT Populate Order Fact Table.
 Two tables should be joined together, DIFT ORDER_ITEM and DIFT ORDERS.
 The Join transformation is used for the inner join based on equality of the ORDER_ID columns
from the input tables.
 The target column OrderDate should be calculated by taking the date portion of the source
column ORDER_DATE, which is a datetime column.
Hint: Use the DATEPART() function.
 The target column DeliveryDate should be calculated by taking the date portion of the source
column DELIVERY_DATE, which is a datetime column.
Hint: Use the DATEPART() function.
 After you verify that the table is created successfully (with no warnings), check in the job object.
OrderFact should have 951,669 observations and 12 variables.
2. Loading the Old_Orders and Recent_Orders Tables
Some specifics for creating the job to load the Old_Orders and Recent_Orders tables are shown
below.
 Name the job DIFT Populate Old and Recent Orders Tables.
 Use the Splitter transformation to split the observations from the OrderFact table.
 Old orders are defined as orders placed before January 1, 2009. You can use the following
expression to find the observations for this data:
OrderDate < '01Jan2009'd
 Recent orders are defined as orders placed on or after January 1, 2009. This expression can be
used to find the observations for this data:
OrderDate >= '01Jan2009'd
 No additional processing is necessary beyond the Splitter transformation. Therefore, the targets
can be loaded directly from the Splitter transformation.
 After you verify that the tables are created successfully, check in the job object.
Recent_Orders should have 615,396 observations and 12 variables.
Old_Orders should have 336,273 observations and 12 variables.

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5-50 Chapter 5 Creating Metadata for Jobs

5.3 Solutions to Exercises


1. Loading the OrderFact Table
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 Order Fact 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 Folders tab.
2) If necessary, expand Data Mart Development Orion Source Data.
3) Right-click the DIFT ORDER_ITEM table object and select Add to Diagram.
4) Right-click the DIFT ORDERS table object and select Add to Diagram.
5) Click the DIFT ORDERS object on the Diagram tab of the Job Editor and drag it away from
the DIFT ORDER_ITEM object. (Initially, these objects are one above the other.)

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.

h. Add inputs to the Join transformation.


1) Click the DIFT ORDER_ITEM connection selector and draw a line to one of the input ports
of the Join transformation.
2) Click the DIFT ORDERS 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 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

l. Review the properties of the Join transformation.


1) Right-click on the Join transformation and select Open. The Designer window appears.
2) Click the Join item in the Navigate pane.

3) In the Join Properties pane, verify that the join is an inner join.

4) Click the Where item in the Navigate pane.


5) Verify that the inner join is executed based on the values of ORDER_ID columns from the
sources being equal.
6) Click the Select item in the Navigate pane to surface the Select tab.
7) Verify that 10 target columns established one-to-one mappings.
8) Verify that two target columns do not have a mapping.

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.3 Solutions to Exercises 5-53

9) Add expressions for the two unmapped columns.

a) Click next to the Target table name to expand the target side.

b) In the Expression field for the OrderDate column, enter datepart(order_date).


c) Press Enter. The expression is updated to datepart(ORDERS.ORDER_DATE).
d) In the Expression field for the DeliveryDate column, enter datepart(delivery_date).
e) Press Enter. The expression is updated to datepart(ORDERS.DELIVERY_DATE).

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

p. Click the Folders tab in the tree view.


1) Expand Data Mart Development Orion Jobs.
2) Verify that the DIFT Populate Order Fact Table job is in this folder.
2. Loading the Old_Orders and Recent_Orders Tables
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 Old and Recent Orders Tables 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 object to the process flow.
1) If necessary, click the Folders tab.
2) Expand Data Mart Development Orion Target Data.
3) Drag the DIFT Order Fact table object to the Diagram tab of the Job Editor.
f. Select File Save to save the diagram and job metadata to this point.
g. Add the Splitter transformation to the diagram.
1) In the tree view, click the Transformations tab.
2) Expand the Data grouping.
3) Select the Splitter transformation.
4) Drag the Splitter transformation to the diagram.
5) Center the Splitter transformation so that it is aligned with the source table object.
h. Select File Save to save the diagram and job metadata to this point.
i. Connect the source table object to the Splitter transformation.
1) Click the DIFT Order Fact connection selector.
2) Drag it to the Splitter transformation to form the connection.
j. Select File Save to save the diagram and job metadata to this point.
k. Add the target table objects to the diagram.
1) Right-click one of the work tables for the Splitter 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 Old Orders.
5) Click OK.
6) Right-click the other work table for the Splitter transformation and select Replace.
7) Verify that the Folders tab is selected.

Copyright © 2012, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
5.3 Solutions to Exercises 5-55

8) Expand the Data Mart Development Orion Target Data folder.


9) Select DIFT Recent Orders.
10) Click OK.
11) If necessary, separate the two target table objects.
The process flow diagram should resemble the following:

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

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.
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

q. Check in the job.


1) Click the Checkouts tab.
2) Select Check Outs Check In All.
3) Enter Adding job that populates old & recent orders in the Title field.
4) Click Next. Verify that the job is selected.
5) Click Next. Review the information in the Summary window.
6) Click Finish. The job object should no longer be on the Checkouts tab.
The Orion Jobs folder should resemble the following:

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

6.2 Solutions to Exercises ................................................................................................. 6-17


Defining and Loading the Customer Dimension Table ......................................................... 6-17
Defining and Loading the Organization Dimension Table .................................................... 6-24
Defining and Loading the Time Dimension Table ................................................................. 6-32
6-2 Chapter 6 Orion Star Case Study

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.

Orion Star Data Mart (Review)


A star schema was adopted as the data model for 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

Order Fact Table Process


The process for the Order Fact
Order Fact table
requires metadata for
two source tables Calculated
Columns
a target table
a process flow OrderDate
DeliveryDate
calculation of two
target columns.

Orders Order_Item

This process was completed in a previous exercise.


4

Product Dimension Table Process


The process for the Product
Product Dimension Dimension
table requires
metadata for Calculated
two source tables Columns
Product_Group
a target table Product_Category
a process flow Product_Line
calculation of three
target columns.

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

Customer Dimension Table Process


The process for the Customer
Customer Dimension Dimension
table requires
metadata for Calculated
two source tables Columns

a target table Customer_Age


Customer_Age_Group
a process flow
calculation of two
target columns.

Customer Customer Types

Organization Dimension Table Process


The process for the Organization
Organization Dimension Dimension
table requires
metadata for Calculated
two source tables Columns
Group
a target table Section
Department
a process flow
Company
calculation of four
target columns.

Organization Staff

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6-6 Chapter 6 Orion Star Case Study

Time Dimension Table Process


The process for the Time
Time Dimension Dimension
table requires
metadata for Calculated
no source tables Columns
All Columns!!
a target table (User-written code
generates
a process flow
the date values.)
calculation of all
target columns
user-written code.

Case Study Scenario


The star schema for the Orion Star data mart has four
dimension tables and one fact table.

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

Case Study Scenario


For each dimension table in the case study, you do the
following:
register source table metadata
create target table metadata
create process flow metadata
execute the process flow
The expected results (for verification) are as follows:

Table Number of Number of


Columns Rows
Customer Dimension 11 89,954

Organization Dimension 13 1,048

Time Dimension 11 4,384


14

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.1 Exercises 6-9

Defining and Loading the Customer Dimension Table


Complete the exercises in this case study. Use Kari’s credentials.
1. Defining the Source Table Metadata for the Customer Dimension
Two source tables are needed for the Customer Dimension table (DIFT Customer Types
and DIFT CUSTOMER).
 The DIFT Customer Types table object was registered in metadata as part of a demonstration
in Chapter 3. If necessary, complete these steps to register the Customer Types table object.
 The DIFT CUSTOMER table object must be registered.
 It is a SAS table located in DIFT Orion Source Tables Library.
 Metadata objects for source tables should be placed in the /Data Mart Development/
Orion Source Data folder.
 Use the naming convention of DIFT <table-name> for the table object.
2. Defining the Target Table Metadata for the Customer Dimension
The following are the specifics for defining the metadata for the Customer Dimension table:
 Name the metadata table object DIFT Customer Dimension.
 Store the metadata object in the /Data Mart Development/Orion Target Data folder.
 The physical table, a SAS table, is to be named CustDim and stored in
DIFT Orion Target Tables Library.
 From the DIFT CUSTOMER table, import (and rename) the following column metadata:

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

 Add two new columns with the following properties:

NAME DESCRIPTION LENGTH TYPE

Customer_Age Customer Age 8 Numeric

Customer_Age_Group Customer Age Group 12 Character

 Create metadata for a simple index based on Customer_ID.


3. Defining the Job Metadata for the Customer Dimension
The specifics for the job to load the DIFT Customer Dimension table are shown below.
 Name the job DIFT Populate Customer Dimension Table.
 Store the job metadata object in the /Data Mart Development/Orion Jobs folder.
 Use the Join transformation to join the source tables (DIFT CUSTOMER and
DIFT Customer Types).
 The target table, DIFT Customer Dimension, should be loaded directly from the Join
transformation.

 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 

The text for the expressions can be found in HelperFile.txt.


 Run the job. The Customer Dimension table should have 89,954 rows and 11 columns.
4. Checking In the Metadata for the Customer 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.1 Exercises 6-11

Defining and Loading the Organization Dimension Table


5. Defining the Source Table Metadata for the Organization Dimension
Two source tables are needed for the organization dimension table (DIFT STAFF and
DIFT ORGANIZATION).
 The DIFT STAFF table object was registered in metadata as part of the exercises at the end
of Chapter 3 (Exercise 5). (The solution is included at the end of that chapter.) If necessary,
complete these steps to register the DIFT STAFF table object.
 The DIFT ORGANIZATION table object must be registered.
 It is a SAS table located in DIFT Orion Source Tables Library.
 Metadata objects for source tables should be placed in the /Data Mart Development/
Orion Source Data folder.
 Use the naming convention of DIFT <table-name> for the table object.
6. Defining the Target Table Metadata for the Organization Dimension
The following are specifics for defining the metadata for the Organization Dimension table:
 Name the metadata table object DIFT Organization Dimension.
 Store the metadata object in the /Data Mart Development/Orion Target Data folder.
 The physical table, a SAS table, is to be named OrgDim, and stored in the DIFT Orion Target
Tables Library.
 From the DIFT ORGANIZATION table, import (and rename) the following column metadata:
Original Column
(in DIFT ORGANIZATION) Rename as…

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

 Add four new columns with the following properties:


NAME LENGTH TYPE

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 Length Type Expression

_Group 8 Numeric input(put(organization.employee_id, orgdim.),12.)

_Section 8 Numeric input(put(calculated _Group, orgdim.),12.)

_Department 8 Numeric input(put(calculated _Section, orgdim.),12.)

_Company 8 Numeric input(put(calculated _Department, orgdim.),12.)

The four columns must be added in the order that is shown.


They must be inserted before the Group, Section, Department, and Company columns.
The text for the expressions can be found in HelperFile.txt.
Add the expressions for the Group, Section, Department, and Company columns.

Name Expression

Group put(calculated _Group, org.)

Section put(calculated _Section, org.)

Department put(calculated _Department, org.)

Company put(calculated _Company, org.)

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 Loader’s 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

Defining and Loading the Time Dimension Table


The Time Dimension table is created with user-written code. Therefore, no metadata objects for source
tables are needed.
9. Defining the Target Table Metadata for the Time Dimension
The Time Dimension table is created with a user-written SAS program. There are two ways
to create the target table metadata:
Method 1: Use the New Table Wizard and enter all column properties manually.
Method 2: Run a modified version of the program that can be used to generate the table.
(This generates a temporary version of the table.) After the table exists, the
Register Tables Wizard can be used to register the table properties.
Choose one of the methods and create a metadata table object for DIFT Time Dimension.
For Method 1:
 Use the New Table Wizard to create a metadata table object named DIFT Time Dimension.
 Store the metadata object in the /Data Mart Development/Orion Target Data folder.
 The following columns must be defined manually:
NAME LENGTH TYPE FORMAT

Date_ID 4 Numeric DATE9.

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

11. Checking In the Metadata for the Time Dimension


After you verify that the job completed successfully, check in all objects.
After you complete the case study, the Orion Jobs folder should resemble the following.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.2 Solutions to Exercises 6-17

6.2 Solutions to Exercises


If necessary, access SAS Data Integration Studio. Use Kari’s credentials.
1. Select Start All Programs SAS SAS Data Integration Studio 4.8.
2. Select Kari’s Work Repository as the connection profile.
3. Click OK to close the Connection Profile window and access the Log On window.
4. Enter Kari in the User ID field and Student1 in the Password field.
5. Click OK to close the Log On window.

Defining and Loading the Customer Dimension Table


1. Defining the Source Table Metadata for the Customer Dimension
a. Click the Folders tab.
b. Expand Data Mart Development Orion Source Data.
c. Verify that the Orion Source Data folder is selected.
d. Select File Register Tables. The Register Tables Wizard appears.
e. Select SAS as the type of table to import information about.
f. Click Next. The Select a SAS Library window appears.
g. Select next to the SAS Library field and then select DIFT Orion Source Tables Library.
h. Click Next. The Define Tables and Select Folder Location window appears.
i. Select the CUSTOMER table.
j. Verify that the location is set to /Data Mart Development/Orion Source Data.
k. Click Next. The review window appears.
l. Verify that the information is correct and click Finish.
m. Click the Checkouts tab.
n. Right-click the CUSTOMER metadata table object and select Properties.
o. Enter DIFT at the beginning of the default name.
p. Click OK to close the Properties window.
2. Defining the Target Table Metadata for the Customer Dimension
a. Click the Folders tab.
b. Expand Data Mart Development Orion Target Data.
c. Verify that the Orion Target Data folder is selected.
d. Select File New Table. The New Table Wizard appears.
e. Enter DIFT Customer Dimension in the Name field.
f. Verify that the location is set to /Data Mart Development/Orion Target Data.
g. Click Next.
h. Verify that the DBMS field is set to SAS.

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:

Original Column Rename as…

Country Customer_Country

Gender Customer_Gender

Birth_Date Customer_Birth_Date

t. Add two additional columns.


1) Select the last column.
2) For each additional column, click New. Assign the following properties:

Column Name Description Length Type

Customer_Age Customer Age 8 Numeric

Customer_Age_Group Customer Age Group 12 Character

u. Define a simple index.


1) Click Define Indexes.
2) Click New to add the index.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
6.2 Solutions to Exercises 6-19

3) Enter an index name of Customer_ID and press Enter.

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.

5) Establish the subsetting criteria.


a) Click the top-level Join item in the Navigate pane to surface the SQL Clauses pane.

b) Double-click the Where item in the SQL Clauses pane to add a WHERE clause.

A WHERE clause is added.

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.

6) Verify the mappings and establish new ones if necessary.


a) Click the Select item in the Navigate pane to surface the Select tab.
b) Manually map the Country source column to the Customer_Country target column.
c) Manually map the Gender source column to the Customer_Gender target column.
d) Manually map the Birth_Date source column to the Customer_Birth_Date target
column.
7) Specify expressions for calculated columns.
a) Click to expand the Target table area.
b) Locate and open the HelperFile.txt file in D:\Workshop\dift.
c) Copy the expression for Customer_Age.

d) Paste the copied code in the Expression field for Customer_Age.
e) Copy the expression for Customer_Age_Group.

f) Paste the copied code in the Expression field for Customer_Age_Group.
g) Click to collapse the Target table area.
8) Manually map the Birth_Date source column to the Customer_Age target column.
(This removes the warning symbol associated with the Customer_Age column.)
m. Click to return to the Job Editor.
n. Right-click in the background of the job and select Run.
o. Verify that the job is completed successfully.

Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.

Potrebbero piacerti anche