SAS Data Set Options |
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 |
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.
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.
sets the number of the first observation to process to 1. This is the default.
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 |
The FIRSTOBS= data set option overrides the FIRSTOBS= system option for the individual data set.
While the FIRSTOBS= data set option specifies a starting point for processing, the OBS= data set option specifies an ending point. The two options are often used together to define a range of observations to be processed.
When external files are read, the FIRSTOBS= option in the INFILE statement specifies which record to read first.
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 |
| |||||
| |||||
|
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.