Methods of Combining SAS Data Sets: The Basics

A common task in SAS programming is to combine observations from two or more data sets into a new data set. Using the DATA step, you can combine data sets in several ways.
Table 13.1 Quick-Reference Overview of Data-Combining Methods
Method of Combining
Illustration
One-to-one reading
Creates observations that contain all of the variables from each contributing data set.
Combines observations based on their relative position in each data set.
Statement: SET
One-to-one merging
Concatenating
Appends the observations from one data set to another.
Statement: SET
Concatenating
Appending
Adds the observations in the second data set directly to the end of the original data set.
Procedure: APPEND
Appending
Interleaving
Intersperses observations in order from two or more data sets, based on one or more common variables.
Statements: SET, BY
Interleaving
Match-merging
Matches observations from two or more data sets into a single observation in a new data set according to the values of a common variable.
Statements: MERGE, BY
Match-merging
Tip
You can also use PROC SQL to join data sets according to common values.
Last updated: January 10, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.164.34