FIRSTOBS= System Option

Specifies the row 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
Supports: All

Syntax

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

Syntax Description

n | nK | nM | nG | nT
specifies the number of the first row or external file record to process in multiples of 1 (bytes); 1,024 (kilobytes); 1,048,576 (megabytes); 1,073,741,824 (gigabytes); or 1,099,511,627,776 (terabytes). For example, a value of 8 specifies 8 bytes, and a value of 3m specifies 3,145,728 bytes.
hexX
specifies the number of the first row 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 row.
MIN
sets the number of the first row or external file record to process to 1. This is the default.
MAX
sets the number of the first row to process to the maximum number of rows 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 rows.

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 about processing a segment of data that is conditionally selected, see the SAS Language Reference: Concepts.
Operating Environment Information: The syntax that is shown here applies to the OPTIONS statement. In 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.

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.
  • The FIRSTOBS= system option specifies a starting point for processing. The OBS= system option specifies an ending point.

Example: Specifying FIRSTOBS

If you specify FIRSTOBS=50, SAS processes the 50th row 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 eleventh row in the data sets OLD, A, and B:
options firstobs=11;
libname myfiles fedsvr server="d1234.us.company.com" 
   port=2171 user=user1 pwd=pass1
   dsn=basedsn;
data myfiles.a;
   set myfiles.old; /* 100 rows */
run;
data myfiles.b;
   set myfiles.a;
run;
data myfiles.c;
   set myfiles.b;
run;
Data set OLD has 100 rows, data set A has 90, B has 80, and C has 70. To avoid decreasing the number of rows 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.