Josh Horstman |
The DATA step is a powerful and versatile tool for manipulating SAS data sets. Because it is built around the concept of reading one record at a time into the Program Data Vector, DATA step programming logic generally has access to only one record at a time. However, there are many situations in which it is advantageous to be able to look back at values from prior records or to look ahead at values from later records. This presentation introduces several advanced DATA step programming techniques that allow the programmer to work with values from multiple records concurrently. Approaches discussed include the double SET statement, the self-merge, the LAG function, and several others. A number of examples are used to explain each method and demonstrate its use. |