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

Goal

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 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.