

Common Techniques Used In Reporting › 5.2 Using CA MICS Files › 5.2.2 A Single File and Multiple Cycles › 5.2.2.2 Interleaving
5.2.2.2 Interleaving
The second way to combine multiple file cycles for processing
is by interleaving the input cycles. The interleaving is
accomplished through use of the BY option associated with the
SET statement. A sort (or interleave) key determines which
input record is processed next.
Again, in this scenario, multiple cycles are read to create a
single SAS data set. Assume that you want to interleave two
files by hour of the day in accordance with their standard
sequence in the BATPGM DETAIL timespan. The BY statement
specifies to SAS how to interleave the observations. The
program and illustration in Figure 5.2 show the result of the
interleave of the two files.
DATA NEWFILE;
SET &PBATX..BATPGM01 &PBATX..BATPGM02;
BY SYSID USER COMMAND PROGRAM MONTH DAY HOUR;
BATPGM01 NEWFILE BATPGM02
DAY HOUR DAY HOUR
+-------------+ Observation # +-------------+
| 1 1 |---+ 1 +----| 1 2 |
+-------------+ | | +-------------+
| 1 3 |--+| 2 |+---| 1 5 |
+-------------+ || || +-------------+
| 1 4 |-+|| 3 ||+--| 2 1 |
+-------------+ ||| ||| +-------------+
||| 4 |||+-| 2 2 |
||| |||| +-------------+
||| ||||
||| ||||
||| DAY HOUR ||||
||| +-------------+ ||||
||+--| 1 1 | ||||
|| +-------------+ ||||
|| | 1 2 |-+|||
|| +-------------+ |||
|+---| 1 3 | |||
| +-------------+ |||
+----| 1 4 | |||
+-------------+ |||
| 1 5 |--+||
+-------------+ ||
| 2 1 |---+|
+-------------+ |
| 2 2 |----+
+-------------+
Copyright © 2014 CA.
All rights reserved.
 
|
|