Example 3.12 Combining and Collapsing Observations Based on a Common Variable


Reshape a transaction data set by turning related observations into single ones. Match each collapsed observation from the transaction data set with an appropriate observation from the master data set, based on the value of a key variable.

Example 3.13 also combines and collapses observations based on a common variable, but its transaction data set is indexed on the common variable and it uses index features to combine the observations.

Example Features

Featured StepPROC TRANSPOSE and DATA step
Featured Step Options and StatementsPROC TRANSPOSE: BY, ID, and VAR statements, PREFIX= option DATA step: match-merge by common variable
Related TechniqueDATA step, arrays, ...

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.