Tips and Tricks Catalog

Create Slowly Changing Dimension (SDC1 and 2) in Data Step

A Slowly Changing Dimension (SCD) is a dimension that stores and manages both current and historical data over time in a data warehouse. It is considered and implemented as one of the most critical ETL tasks in tracking the history of dimension records. Different SCD strategies could be implemented and this tips and tricks is focused on SCD1 where records are updated no history is kept and SCD2 where history is kept,

Details

To ease the concept, in this tips and tricks we will use the table SASHELP.CLASS and considering name & sex as SCD1 columns and age, height & weight as SCD2 columns.
We will first analyse the SAS code block by block and then test it to crosscheck that everything is working as expected. The following SAS technics will be discussed::

  • using proc sort to sort and remove duplicate entries
  • using merge statement to combine dimension and landing data
  • compare records values using md5 function
  • create tables simultenaously using explicit output statement
  • update table using modify/replace statements
  • load new records using proc append

Prerequisites

You have some SAS experience and have knowledge in Datawarehouse. You want to update existing tables using SCD method.




This site uses cookies. .

By continuing to browse the site you are agreeing to our use of cookies. Review our cookies information for more details.