Specifies the last observation that SAS processes in a data set.
Valid in: | DATA step and PROC steps |
Category: | Observation Control |
Default: | MAX |
Restrictions: | Use with input data sets only. |
Cannot use with PROC SQL views |
specifies a number
to indicate when to stop processing observations, with n as
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 20
specifies
20 observations, and a value of 3m
specifies
3,145,728 observations.
specifies a number
to indicate when to stop processing as a hexadecimal value. You must
specify the value beginning with a number (0–9), followed by
an X. For example, the hexadecimal value F8
must
be specified as 0F8x
in order to specify
the decimal equivalent of 248. The value 2dx
specifies
the decimal equivalent of 45.
specifies the number to indicate when to stop processing to 0. Use OBS=0 to create an empty data set that has the structure, but not the observations, of another data set.
Interaction | If OBS=0 and the NOREPLACE option is in effect, SAS can still take certain actions. SAS actually executes each DATA and PROC step in the program, using no observations. For example, SAS executes procedures, such as CONTENTS and DATASETS, that process libraries or SAS data sets. |
specifies the number to indicate when to stop processing to the maximum number of observations in the data set. This number can be up to the largest 8-byte, signed integer, which is 263–1, or approximately 9.2 quintillion. This is the default.
(obs - firstobs) + 1 = results
(10 - 1) + 1 = 10
.
If OBS=10 and FIRSTOBS=2, the result is nine observations. That is, (10
- 2) + 1 = 9
. OBS= is valid only when an existing
SAS data set is read.
(12
- 2) + 1 = 11
. The result of OBS= appears to be the
observation number that SAS processes last.
data Ages; input Name $ Age; datalines; Miguel 53 Brad 27 Willie 69 Marc 50 Sylvia 40 Arun 25 Gary 40 Becky 51 Alma 39 Tom 62 Kris 66 Paul 60 Randy 43 Barbara 52 Virginia 72 ; proc print data=Ages (firstobs=2 obs=12); run;
proc print data=Ages; where Age LT 65; run;
(10 - 1) + 1 = 10
. With WHERE
processing, SAS subsets the data and applies OBS= to the subset.
proc print data=Ages (obs=10); where Age LT 65; run;
(10 - 2) + 1 = 9
. OBS= is neither
the observation number to end with nor how many observations to process;
the value is used in the formula to determine when to stop processing.
proc print data=Ages (firstobs=2 obs=10); where Age LT 65; run;
proc print data=Ages; run;
(12
- 1) + 1 = 12
: proc print data=Ages (obs=12); run;
(12
- 2) + 1 = 11
. OBS= is neither the observation number
to end with nor how many observations to process; the value is used
in the formula to determine when to stop processing.
proc print data=Ages (firstobs=2 obs=12); run;