SAS Interleave - Combining Datasets using BY statement

1. INTERLEAVING :

Interleaving combines individual sorted datasets into one sorted data set by specified variable in the By Statement

Before we interleave any SAS datasets they must be sorted by the same variable If the datasets are already indexed there is no need to sort them

ILLUSTRATION

SAS Code for Interleaving

DATA C;

SET A B;

BY ID value;

RUN;

Output:

The OUTPUT dataset C will be