Chapter Contents

Previous

Next
FIRSTOBS=

FIRSTOBS=



Causes SAS to begin reading at a specified observation or record

Valid in: configuration file, SAS invocation, OPTIONS statement, Systems Options window
Category: Files: SAS files
PROC OPTIONS GROUP= SASFILES


Syntax
Syntax Description
Details
Comparisons
Examples
See Also

Syntax

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

Syntax Description

n | nK | nM | nG
specifies the first observation or record that SAS reads in terms of bytes, kilobytes, megabytes, or gigabytes, respectively.

MIN
sets the first observation or record that SAS reads to 1.

MAX
sets the first observation or record that SAS reads as the largest signed, 4-byte integer representable in your operating environment.

hex
specifies the first observation or record that SAS reads as a hexadecimal number. This number must be followed by an X.


Details

FIRSTOBS must be set to 1 in order to use a WHERE statement or a WHERE= data set option. By default, FIRSTOBS=1.

CAUTION:
Using the FIRSTOBS= system option determines the first observation that is read for all steps for the duration of your current SAS session or until you change the setting. To affect any single file, you can use the FIRSTOBS= data set option.   [cautionend]


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.


Examples

If you specify FIRSTOBS=50, SAS reads 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 eleventh 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.

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 SAS documentation for your operating environment.  [cautionend]

See Also

Data Set Option:
FIRSTOBS=
Statement:
INFILE
System Option:
OBS=


Chapter Contents

Previous

Next

Top of Page

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