Solved
New Contributor
Posts: 4

# Data structure - horizontal vs vertical

I am currently building a solution in Excel that will allow users to enter information on a template and have SAS import the template for calculations. The template will include start and end dates for a given condition. In this case, the condition refers to the department that employees work within. Since employees change departments, we want to track data based on which department they completed the work for.

Currently, I am looking at this in two different ways (see charts below). Table one has the employees enter changes by including new rows of data. Table two has the employees enter changes by including new columns of data. Does anyone have experience with which of these data structures works best for longevity and flexibility? I want the best long term solution.

Kyle

Vertical
 Employee Department Start date End date John Finance 1/1/2015 3/31/2015 John Marketing 3/31/2015 12/31/2015 Mary Operations 1/1/2015 12/31/2015 Susan Sales 1/1/2015 12/31/2015
Horizontal
 Employee Department Start date End date Team Start date End date John Finance 1/1/2015 3/31/2015 Marketing 3/31/2015 12/31/2015 Mary Operations 1/1/2015 12/31/2015 Susan Sales 1/1/2015 12/31/2015

Accepted Solutions
Solution
‎07-01-2015 02:58 PM
Super User
Posts: 19,789

## Re: Data structure - horizontal vs vertical

Vertical, it is a common data structure, and you can easily determine which is the latest/first via sorting by date. You can either leave the end date missing for current positions or set it to something like Dec 31 9999.

FYI This is called a Type 2 Slowly Changing Dimension (SCD)

Slowly changing dimension - Wikipedia, the free encyclopedia

All Replies
Valued Guide
Posts: 860

## Re: Data structure - horizontal vs vertical

I think vertical is the way to go, add a date field for when the record was added and changed and you can sort by that if necessary, horizontal can get ugly depending on how long this is in use.

Solution
‎07-01-2015 02:58 PM
Super User
Posts: 19,789

## Re: Data structure - horizontal vs vertical

Vertical, it is a common data structure, and you can easily determine which is the latest/first via sorting by date. You can either leave the end date missing for current positions or set it to something like Dec 31 9999.

FYI This is called a Type 2 Slowly Changing Dimension (SCD)

Slowly changing dimension - Wikipedia, the free encyclopedia

Community Manager
Posts: 564

## Re: Data structure - horizontal vs vertical

Also, LinusH wrote an article series on SCDs that may be helpful.

🔒 This topic is solved and locked.