O'Reilly logo

Step-by-Step Programming with Base SAS 9.4, Second Edition, 2nd Edition by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

BY variable-list;
The SET statement reads multiple sorted SAS data sets and creates one sorted SAS data
set. SAS-data-sets is a list of the SAS data sets to interleave.
The BY statement is used with a SET statement to perform BY-group processing.
Variable-list contains the names of one or more variables (BY variables) by which to
interleave the data sets. All of the data sets must be sorted by the same variables before
you can interleave them.
Learning More
Indexes
You do not need to sort unordered data sets before interleaving them if the data sets
have an index on the variable or variables by which you want to interleave. For more
information, see “Understanding SAS Indexes” in SAS Language Reference:
Concepts.
Combining SAS data sets
For information about combining SAS data sets using the SET statement when the
data sets contain different variables, attributes, types, or lengths, see “Concatenating
Data Sets with the SET Statement” on page 258.
For information about combining SAS data sets with the APPEND procedure, see
“Concatenating Data Sets By Using the APPEND Procedure” on page 274.
The same rules apply to interleaving data sets as to concatenating them.
SORT procedure and the BY statement
For more information, see Chapter 12, “Working with Grouped or Sorted
Observations,” on page 183.
Learning More 287
288 Chapter 18 Interleaving SAS Data Sets

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required