Creating One Observation per Detail Record

Overview

In order to create one observation per detail record, it is necessary to distinguish between header and detail records. Having a field that identifies the type of the record makes this task easier.
In the partial raw data file Census, shown below, H indicates a header record that contains a street address, and P indicates a detail record that contains information about a person who lives at that address.
Partial Raw Data File
Let's see how you can create a data set that contains one observation for each person who lives at a specific address.

Retaining the Values of Variables

As you write the DATA ...

Get SAS Certification Prep Guide: Base Programming for SAS 9, Third 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.