ENDOBS= Table Option

Specifies the end row number in a user-defined range for the processing of a given table.

Valid in: SPD Server

Syntax

ENDOBS=n

Required Argument

n

specifies the number of the end row.

Details

By default, the server processes the entire table unless the user specifies a range of rows with the STARTOBS= option and the ENDOBS= option. If the STARTOBS= option is used without the ENDOBS= option, the implied value of ENDOBS= is the end of the table. When both options are used together, the value of ENDOBS= must be greater than STARTOBS=.
In contrast to the Base SAS software options FIRSTOBS= and OBS=, the STARTOBS= and ENDOBS= SPD Server options can be used for WHERE clause processing in addition to table input operations. When ENDOBS= is used in a WHERE expression, the ENDOBS= value represents the last observation to process, rather than the number of observations to return. The following examples show the difference.

Examples

Example 1: Use ENDOBS= with STARTOBS=

Create server table TempData.Old_Autos and print only rows 2-4.
libname tempdata sasspds 'conversion_area'
   server=husky.5105
   user='siteusr1'
   prompt=yes;

proc sql;
create table tempdata.old_autos(
   Year char(4),
   Manufacturer char(12),
   Model char(10),
   Body_style char(5),
   Engine_liters num,
   Trans_type char(1),
   Ext_color char(10),
   Options char(10),
   Mileage num,
   Condition num);

insert into tempdata.old_autos values('1971', 'Buick', 'Skylark', 'conv', 5.8,'A', 
'yellow', '0000001', 143000, 2);
insert into tempdata.old_autos values('1982', 'Ford', 'Fiesta', 'hatch', 1.2, 'M', 
'silver', '0000001', 70000, 3);
insert into tempdata.old_autos values('1975', 'Lancia', 'Beta', '2door', 1.8, 'M', 
'drk blue', '0000010', 80000, 4);
insert into tempdata.old_autos values('1966', 'Oldsmobile','Toronado', '2door', 7.0, 
'A', 'black', '11000010', 210000, 3);
insert into tempdata.old_autos values('1969', 'Ford', 'Mustang', 'sptrf', 7.1, 'M', 
'red', '0000111', 125000, 3);
quit;

proc print data=tempdata.old_autos (startobs=2 endobs=4);
run;
Print rows 2 to 4 from table TempData.Old_Autos.

Example 2: Use ENDOBS= with a WHERE Clause

Print rows from table TempData.Old_Autos where Trans_type="M" and ENDOBS=2. ENDOBS= specifies to stop processing at row 2 .
proc print data=tempdata.old_autos(endobs=2); 
where trans_type="M";
run;
ENDOBS= specifies to stop processing at row 2 .

See Also

SPD Server LIBNAME options:
SPD Server macro variables:
Last updated: February 8, 2017