Example 8.16 Obtaining Hierarchical Data from a Table and Matching Them to the Rows in the Same Table
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.
|Featured Step||PROC SQL|
|Featured Step Options and Statements||Self-join, WHERE clause|
|Related Technique||DATA step, match-merging a data set with itself|
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 ...