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
Interaction: When you specify the FIRSTOBS= option and EXTENDOBSCOUNTER=YES is set either as a data set option or as a LIBNAME option, data sets that have 2G–1 observations or more might perform better in a 32-bit environment. For more information, see Extending the Observation Count in a SAS Data File in SAS Language Reference: Concepts.
Note: This option can be restricted by a site administrator. For more information, see Restricted Options.

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.

Comparisons

  • You can override the FIRSTOBS= system option by using the FIRSTOBS= data set option and by using the FIRSTOBS= option as a part of the INFILE statement.
  • While the FIRSTOBS= system option specifies a starting point for processing, the OBS= system option specifies an ending point. The two options are often used together to define a range of observations or records to be processed.

Example

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 Options:
FIRSTOBS= Data Set Option in SAS Data Set Options: Reference
Statements:
INFILE Statement in SAS Statements: Reference
System Options: