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.4 Separating the First Observation in a BY Group from the Other Observations in the BY Group

Goal

Write the first observation in a BY group to one data set. Write the other observations in the BY group to a second data set.

Example Features

Featured StepDATA step
Featured Step Options and StatementsFIRST.variable and LAST.variable temporary variables
Related TechniquePROC SORT, DUPOUT=, NODUPKEY, and OUT= options

Input Data Set

Data set TRADE_ASSN contains membership records for four members of a trade association. Each observation stores the membership information for one company for one year. Note that three of the four companies have more than one observation and that one company, Surname Associates, has only one observation.

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