Controlling Execution

Restricting Row Processing

When you are developing queries against large tables, you can reduce the amount of time that it takes for the queries to run by reducing the number of rows that PROC SQL processes. Subsetting the tables with WHERE clauses is one way to do this. Using the INOBS= and OUTOBS= options in PROC SQL is another way.
You already know that you can use the OUTOBS= option to restrict the number of rows that PROC SQL displays or writes to a table. However, the OUTOBS= option does not restrict the rows that are read. The INOBS= option restricts the number of rows that PROC SQL takes as input from any single source. The INOBS= option is similar to the SAS system option OBS= and is useful for debugging queries on large tables.
Note: For more information about the OUTOBS= option, see Performing Advanced Queries Using PROC SQL.

Example

In the following PROC SQL set operation, INOBS=5 is specified. As indicated in the log, only five rows from each source table, Sasuser.Mechanicslevel1 and Sasuser.Mechanicslevel2, are used. The resulting table contains 10 rows.
proc sql inobs=5;
   select *
      from sasuser.mechanicslevel1
   outer union corr
   select *
      from sasuser.mechanicslevel2;
Table 8.4 SAS Log
183   proc sql inobs=5;
184     select *
185        from sasuser.mechanicslevel1
186     outer union corr
187     select *
188        from sasuser.mechanicslevel2;

WARNING: Only 5 records were read from SASUSER.MECHANICSLEVEL1
         due to INOBS= option.
WARNING: Only 5 records were read from SASUSER.MECHANICSLEVEL2
         due to INOBS= option.
sas log
Tip
You can use the PROMPT | NOPROMPT option with the INOBS= and OUTOBS= options so that you are prompted to stop or continue processing when the limits set by these options are reached.
Note: For more information about PROC SQL set operations, see Combining Tables Vertically Using PROC SQL.
CAUTION:
In a simple query, there might be no apparent differences between using INOBS= or OUTOBS=. Other times, it is important to choose the correct option. For example, using the average function on a column with the PROC SQL option INOBS=10 returns an average of only the 10 values read for that column.
..................Content has been hidden....................

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