STARTOBS= Table Option

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

Valid in: SPD Server

Syntax

STARTOBS=n

Required Argument

n

is the number of the start row.

Details

By default, the server processes the entire table unless the user specifies a range of rows with the STARTOBS= and ENDOBS= options. If the ENDOBS= option is used without the STARTOBS= option, the implied value of STARTOBS= is 1. When both options are used together, the value of STARTOBS= must be less than ENDOBS=.
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 STARTOBS= is used in a WHERE expression, the STARTOBS= value represents the first observation on which to apply the WHERE expression.

Examples

Example 1: Use STARTOBS= with ENDOBS=

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;
STARTOBS= and ENDOBS= specify to print only rows 2-4.

Example 2: Use STARTOBS= with a WHERE Clause

Print rows from table TempData.Old_Autos where Trans_type="M" and STARTOBS=4. STARTOBS= specifies to begin applying the WHERE expression at row 4.
proc print data=tempdata.old_autos(startobs=4);
where Trans_type="M";
run;
STARTOBS= specifies to begin applying the WHERE expression at row 4.

See Also

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