Interleaving

Overview

If you use a BY statement when you concatenate data sets, the result is interleaving. Interleaving intersperses observations from two or more data sets, based on one or more common variables.
To interleave SAS data sets, specify a list of data set names in the SET statement, and specify one or more BY variables in the BY statement.
General form, basic DATA step for interleaving:
DATA output-SAS-data-set;
SET SAS-data-set-1 SAS-data-set-2;
BY variable(s);
RUN;
where
  • output-SAS-data-set names the data set to be created
  • SAS-data-set-1 and SAS-data-set-2 specify the data sets to be read.
  • variable(s) specifies one or more variables that are used to interleave observations.
You can specify any ...

Get SAS Certification Prep Guide: Base Programming for SAS 9, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.