Limiting the Number of Rows Displayed

Overview

When you create PROC SQL queries, you sometimes find it useful to limit the number of rows that PROC SQL displays in the output. To indicate the maximum number of rows to be displayed, you can use the OUTOBS= option in the PROC SQL statement.
General form, PROC SQL statement with OUTOBS= option:
PROC SQL OUTOBS= n;
Here is an explanation of the syntax:
n
specifies the number of rows.
Note: The OUTOBS= option restricts the rows that are displayed, but not the rows that are read. To restrict the number of rows that PROC SQL takes as input from any single source, use the INOBS= option. For more information about the INOBS= option, see Managing Processing Using PROC SQL.

Example

Suppose you want to quickly review the types of values that are stored in a table, without printing out all the rows. The following PROC SQL query selects data from the table Sasuser.Flightschedule, which contains more than 200 rows. To print only the first 10 rows of output, you add the OUTOBS= option to the PROC SQL statement.
proc sql outobs=10;
   select flightnumber, date
      from sasuser.flightschedule;
First 10 Rows from the Table Sasuser.Flightschedule
When you limit the number of rows that are displayed, a message similar to the following appears in the SAS log.
Table 2.2 SAS Log
WARNING: Statement terminated early due to OUTOBS=10 option.
Note: The OUTOBS= and INOBS= options affect tables that are created by using the CREATE TABLE statement and your report output.
Note: In many of the examples in this chapter, OUTOBS= is used to limit the number of rows that are displayed in output.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.34.161