Example 8.5 Accessing a Specific Number of Observations from the Beginning and End of a Data Set

Goal

Process a specific number of observations at the beginning and end of a data set. Efficiently access the observations by not reading the entire data set. If the total number of observations in the data set is less than the sum of observations to access, process the entire data set.

Example Features

Featured StepDATA step
Featured Step Options and StatementsDirect access, SET statement, NOBS= and POINT= options

Input Data Set

Data set BLOODPRESSURE contains 20 blood pressure measurements.

                         BLOODPRESSURE

        Obs    bptime    systolic    diastolic    pulse 1 8:20 160 90 99 2 8:22 171 92 103 3 8:24 158 88 102 4 8:30 155 90 93 5 8:43 144 88 90 6 8:51 145 82 88 ...

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.