backnextLearning Path
   


Introduction

Combining data horizontally refers to the process of merging or joining multiple data sets into one data set. This process is referred to as a horizontal combination because in the final data set, each observation (or horizontal row) will have variables from both input data sets.


Combining data sets horizontally


It is useful to combine data horizontally if you have several data sets that contain different but related information. For example, suppose you have one data set that contains employee data with the variables IDNumber, Name, and Address, and another data set that contains employee data with the variables IDNumber and Salary. You can horizontally combine the data from these two input data sets to create an output data set that contains IDNumber, Name, Address, and Salary.

There are several methods for combining data horizontally. This lesson focuses on several methods of combining data horizontally in the DATA step, and compares a DATA step match-merge with a PROC SQL join.


Time to Complete

This lesson contains pages and takes approximately 1.5 hours to complete.



Objectives

In this lesson, you learn to

  • use the DATA step with the MERGE statement to combine data sets without a common variable
  • use the SQL procedure to combine data sets without a common variable
  • identify the difference between the DATA step match-merge and the PROC SQL join
  • create an output data set that contains summary statistics from PROC MEANS
  • combine summary statistics in a data set with a detail data set
  • calculate summary data and combine it with detail data within one DATA step
  • use the SET statement with the KEY= option to combine two SAS data sets
  • use an index to combine two data sets
  • use _IORC_ to determine whether the index search was successful.

Prerequisites

Before taking this lesson, you should complete the following lessons:

  • .

  Copyright © 2003 SAS Institute Inc., Cary, NC, USA. All rights reserved.
Terms of Use & Legal Information | Privacy Statement
backnext