Previous Page | Next Page

SAS System Options

FIRSTOBS= System Option



Specifies the observation number or external file record that SAS processes first.
Valid in: configuration file, SAS invocation, OPTIONS statement, SAS System Options window
Category: Files: SAS Files
PROC OPTIONS GROUP= SASFILES

Syntax
Syntax Description
Details
Comparisons
Examples
See Also

Syntax

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


Syntax Description

n | nK | nM | nG | nT

specifies the number of the first observation or external file record to process, with n being an integer. Using one of the letter notations results in multiplying the integer by a specific value. That is, specifying K (kilo) multiplies the integer by 1,024; M (mega) multiplies by 1,048,576 ; G (giga) multiplies by 1,073,741,824; or T (tera) multiplies by 1,099,511,627,776. For example, a value of 8 specifies the eighth observations or records, and a value of 3m specifies observation or record 3,145,728.

hexX

specifies the number of the first observation or the external file record 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 specifies the 45th observation.

MIN

sets the number of the first observation or external file record 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 sets or records in the external file, up to the largest eight-byte, signed integer, which is 263-1, or approximately 9.2 quintillion observations.


Details

The FIRSTOBS= system option is valid for all steps for the duration of your current SAS session or until you change the setting. To affect any single SAS data set, use the FIRSTOBS= data set option.

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

Operating Environment Information:   The syntax that is shown here applies to the OPTIONS statement. On the command line or in a configuration file, the syntax is specific to your operating environment. For details, see the documentation for your operating environment.  [cautionend]


Comparisons


Examples

If you specify FIRSTOBS=50, SAS processes the 50th observation of the data set first.

This option applies to every input data set that is used in a program or a SAS process. In this example, SAS begins reading at the 11th observation in the data sets OLD, A, and B:

options firstobs=11;

data a;
   set old; /* 100 observations */
run;

data b;
   set a;
run;

data c;
   set b;
run;

Data set OLD has 100 observations, data set A has 90, B has 80, and C has 70. To avoid decreasing the number of observations in successive data sets, use the FIRSTOBS= data set option in the SET statement. You can also reset FIRSTOBS=1 between a DATA step and a PROC step.


See Also

Data Set Option:

FIRSTOBS= Data Set Option

Statement:

INFILE Statement

System Option:

OBS= System Option

Previous Page | Next Page | Top of Page