O'Reilly logo

Combining and Modifying SAS® Data Sets: Examples Second Edition by Michele M. Burlew

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example 8.16 Obtaining Hierarchical Data from a Table and Matching Them to the Rows in the Same Table

Goal

Identify hierarchically related rows in a table. For each group of hierarchically related rows, extract data from the row that is at the higher level of the hierarchy and join these values to all rows in the group.

Example Features

Featured StepPROC SQL
Featured Step Options and StatementsSelf-join, WHERE clause
Related TechniqueDATA step, match-merging a data set with itself

Input Table

Table PERSONS records survey information about persons in households. It has data for four households. The respondent to the survey has a value of "reference" for column RELATIONSHIP. These rows are considered at the higher level of the hierarchy within ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required