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
more than one input data set.
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 combine the data from these
two input data sets horizontally to create an output data set that
contains IDNumber, Name, Address, and Salary.
This chapter focuses
on several methods of combining data horizontally in the DATA step,
and compares a DATA step match-merge with a PROC SQL join. This chapter
also covers several techniques for horizontally combining data from
an input data set with values that are not stored in a SAS data set.