Example 3.13 Combining and Collapsing Observations Based on a Common Variable When the Transaction Data Set Is Indexed


Reshape a data set by turning related observations into single ones. Match the collapsed observations from this data set with an appropriate observation from another data set based on the value of a key variable that is indexed in the first data set.

Example 3.12 also combines and collapses observations based on a common variable, but Example 3.12 does not use code that relies on indexes.

Example Features

Featured StepDATA step
Featured Step Options and StatementsKEY= option in the SET statement Automatic variable _IORC_ and %SYRC autocall macro program

Input Data Sets

Data set KIDS_IDS contains identification information ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.