Previous Page | Next Page

SAS Data Set Options

FIRSTOBS= Data Set Option



Specifies the first observation that SAS processes in a SAS data set.
Valid in: DATA step and PROC steps
Category: Observation Control
Restriction: Valid for input (read) processing only.
Restriction: Cannot use with PROC SQL views.

Syntax
Syntax Description
Details
Comparisons
Examples
See Also

Syntax

FIRSTOBS= n| nK | nM | nG | hexX | MIN | MAX


Syntax Description

n | nK | nM | nG

specifies the number of the first observation to process in multiples of 1 (bytes); 1,024 (kilobytes); 1,048,576 (megabytes); or 1,073,741,824 (gigabytes). For example, a value of 8 specifies the 8th observation, and a value of 3k specifies 3,072.

hexX

specifies the number of the first observation to process as a hexadecimal value. You must specify the value beginning with a number (0-9), followed by an X. For example, the value 2dx sets the 45th observation as the first observation to process.

MIN

sets the number of the first observation to process to 1. This is the default.

MAX

sets the number of the first observation to process to the maximum number of observations in the data set, up to the largest eight-byte, signed integer, which is 263-1, or approximately 9.2 quintillion observations.


Details

The FIRSTOBS= data set option affects a single, existing SAS data set. Use the FIRSTOBS= system option to affect all steps for the duration of your current SAS session.

FIRSTOBS= is valid for input (read) processing only. Specifying FIRSTOBS= is not valid for output or update processing.

You can apply FIRSTOBS= processing to WHERE processing. For more information, see Processing a Segment of Data That Is Conditionally Selected in SAS Language Reference: Concepts.


Comparisons


Examples

This PROC step prints the data set STUDY beginning with observation 20:

proc print data=study(firstobs=20);
run;

This SET statement uses both FIRSTOBS= and OBS= to read-only observations 5 through 10 from the data set STUDY. Data set NEW contains six observations.

data new;
  set study(firstobs=5 obs=10);
run;


See Also

Data Set Options:

OBS= Data Set Option

Statements:

INFILE Statement

WHERE Statement

System Options:

FIRSTOBS= System Option

Previous Page | Next Page | Top of Page