Chapter Contents

Previous

Next
OBS=

OBS=



Causes processing to end with the nth observation

Valid in: DATA step and PROC steps
Category: Observation Control
Restriction: Use with input data sets only.


Syntax
Syntax Description
Details
Comparisons
Examples
See Also

Syntax

OBS=n|MAX

Syntax Description

n
specifies a positive integer that is less than or equal to the number of observations in the data set or zero.

MAX
represents the total number of observations in the data set.


Details

This option specifies the number of the last observation to process, not how many observations should be processed. It is valid only when an existing SAS data set is read.

Use OBS=0 to create an empty data set that has the structure, but not the attributes, of another data set.

You cannot use the OBS= data set option when a WHERE statement or WHERE= data set option is specified in the same DATA or PROC step.


Comparisons


Examples

In this example, the OBS= data set option in the SET statement reads in the first ten observations from data set OLD:

data new;
    set old(obs=10);
run;

This statement prints only observations 5 through 10 in data set STUDY:

proc print data=study(firstobs=5 obs=10);

See Also

Data Set Options:

FIRSTOBS=

Statements:

INFILE
WHERE

System Options:

OBS=


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.