Professional Documents
Culture Documents
Using The SCD Type 1 Loader Transformation
Using The SCD Type 1 Loader Transformation
Transformation
Only if maintaining
Update without retaining
Yes Yes historical records for
historical records some column changes
If the dimension table needs to retain historical records, the SCD Type 2 transformation should be
used. The SCD Type 2 transformation can generate surrogate keys and update columns without
retaining historical records as long as at least one column’s historical records are being maintained.
It can also update selected columns.
The SCD Type 1 transformation can generate surrogate keys, update columns without retaining
historical records, and update selected columns from a table.
The Table Loader transformation cannot retain historical records or update only specific columns, but
it can perform updates without retaining historical records. It can also be configured to prevent
incoming missing values from replacing nonmissing values.
The SCD Type 1 and SCD Type 2 transformations maintain cross reference tables with digest
values. Cross reference tables contain one row for each row in the dimension table. They have a
column for the generated key, the business key, and a digest column. The digest column contains an
encrypted concatenation of the columns selected for change detection and is used to detect
changes between the source and target rows. Cross reference tables make the type of comparisons
performed by the SCD Type 1 and SCD Type 2 transformations more efficient.
Features of SCD Type 1 Transformation
The SCD Type 1 transformation has several primary features:
• A match key is used to match update records with target table records.
• Updates can occur for changes in selected columns.
• A new record can be inserted when no matching key is found.
• A surrogate key can be generated.
• A datetime column can optionally be generated to track the date/time
for each update or insert.
95
Copyri g ht © S A S Insti tute Inc. A l l ri g hts reserved.
new records
inserted
Target table
Source table
(updates)
97
Copyri g ht © S A S Insti tute Inc. A l l ri g hts reserved.
No change
98
Copyri g ht © S A S Insti tute Inc. A l l ri g hts reserved.
Change in Change-Tracked Column
Key column Change-tracked column
Salary and
Birth_Date
different but
only Salary will
be updated
99
Copyri g ht © S A S Insti tute Inc. A l l ri g hts reserved.
A missing value
for Salary in
update record
results in a
missing value
replacing a
nonmissing
value in the
target.
100
Copyri g ht © S A S Insti tute Inc. A l l ri g hts reserved.
Missing Value for Change-Tracked Column
Key column Change-tracked column
No matching
key; new
employee
record will be
added
101
Copyri g ht © S A S Insti tute Inc. A l l ri g hts reserved.
3.06 Poll
Can SCD Type 1 updates be performed by transformations other than
the SCD Type 1 transformation?
True
False
102
Copyri g ht © S A S Insti tute Inc. A l l ri g hts reserved.
Using the SCD Type 1 Transformation
This demonstration illustrates updating a dimension table with the SCD Type 1 transformation.
1. If necessary, access SAS Data Integration Studio using Bruno’s credentials.
a. Select Start All Programs SAS SAS Data Integration Studio.
b. Select My Server as the connection profile.
c. Click OK to close the Connection Profile window. The Log On window appears.
d. Enter Bruno in the User ID field and Student1 in the Password field.
e. Click OK to close the Log On window.
2. Import the starter objects.
a. Click the Folders tab.
b. Right-click the Data Mart Development folder and select Import SAS Package.
The Import SAS Package Wizard appears.
c. Click Browse next to the Enter the location of the input SAS package file field.
The Browse window appears.
1) If necessary, navigate to D:\Workshop\dift\solutions\ELP_Packages.
Note: This package can also be downloaded from the ELP Packages folder on the
Extended Learning Page.
2) Click DI_ELP_SCDType1Demo.spk.
3) Click OK.
d. Click Next until the Summary screen appears (accept the defaults on each panel).
e. Click Next on the Summary screen.
f. Click Finish to complete the import.
3. Create a job that uses the SCD Type 1 transformation to load monthly updates to the Staff
Dimension table.
a. Create the initial job metadata.
1) If necessary, click the Folders tab.
2) If necessary, expand Data Mart Development Orion SCD.
3) Right-click the Orion SCD folder and select New Job. The New Job Wizard appears.
4) Enter DIFT SCD1 Update Staff Dimension as the name.
5) Verify that the value for Location is /Data Mart Development/Orion SCD.
6) Click OK. The job editor appears.
b. Add the source table object to the job flow diagram.
1) Click the Folders tab.
2) If necessary, expand Data Mart Development Orion SCD.
3) Drag the DIFT SCD1 M1 Staff Updates table and drag to the job editor.
c. Add the SCD Type 1 Loader transformation to the job flow diagram.
1) Click the Transformations tab.
2) Expand the Data group.
3) Click SCD Type 1 Loader and drag it to the job editor.
4) Connect the DIFT SCD1 M1 Staff Updates table as input for the SCD Type 1
transformation.
d. Add the output table to the job flow diagram.
1) Click the Folders tab.
2) From the Orion SCD folder, select the DIFT SCD1 Staff Dimension table and drag to
the job editor.
3) Position the mouse pointer on an output item of the SCD Type 1 transformation to see a
description.
4) Connect the fourth output item of the SCD Type 1 transformation to the DIFT SCD1 Staff
Dimension table.
Specify to generate a
surrogate key
SK selected as the
surrogate key column
Note: The SK and LastUpdated columns are populated by the SCD Type 1 transformation.
j. Click OK to close the SCD Type 1 Properties.
6. Select File Save to save the current job metadata.
7. Review the current data before running the job.
a. Right-click DIFT SCD1 Staff Dimension and select Open.