PROC SQL Statement
specifies the internal
transient buffer page size for the PROC SQL paged memory subsystem.
PROC SQL uses this subsystem to help implement operations such as
joins, aggregations, and intersections. The output is in multiples
of 1 (bytes), 1024 (kilobytes), 1,048,576 (megabytes), or 1,073,741,824
(gigabytes). For example, a value of 65536 specifies a page size of 65536
bytes,
and a value of 64k
specifies a page
size of 65536 bytes.
Default | 0, which causes SAS to use the minimum optimal page size for the operating environment. |
specifies whether the SQL procedure replaces references to the DATE, TIME, DATETIME, and TODAY functions in a query with their equivalent constant values before the query executes. Computing these values once ensures consistency of results when the functions are used multiple times in a query or when the query executes the functions close to a date or time boundary.
Default | CONSTDATETIME |
Interaction | If both the CONSTDATETIME option and the REDUCEPUT= option are specified, PROC SQL replaces the DATE, TIME, DATETIME, and TODAY functions with their respective values in order to determine the PUT function value before the query executes. |
Tip | Alternatively, you can set the SQLCONSTDATETIME system option. The value that is specified in the SQLCONSTDATETIME system option is in effect for all SQL procedure statements, unless the PROC SQL CONSTDATETIME option is set. The value of the CONSTDATETIME option takes precedence over the SQLCONSTDATETIME system option. The RESET statement can also be used to set or reset the CONSTDATETIME option. However, changing the value of the CONSTDATETIME option does not change the value of the SQLCONSTDATETIME system option. For more information, see the SQLCONSTDATETIME System Option. |
double-spaces the report.
Default | NODOUBLE |
Example | Combining Two Tables |
specifies whether PROC SQL treats values within double quotation marks (" ") as variables or strings. With DQUOTE=ANSI, PROC SQL treats a quoted value as a variable. This feature enables you to use the following as table names, column names, or aliases:
Default | SAS |
specifies whether PROC SQL stops executing if it encounters an error. In a batch or noninteractive session, ERRORSTOP instructs PROC SQL to stop executing the statements but to continue checking the syntax after it has encountered an error.
Default | NOERRORSTOP in an interactive SAS session; ERRORSTOP in a batch or noninteractive session |
Interaction | This option is useful only when the EXEC option is in effect. |
Tips | ERRORSTOP has an effect only when SAS is running in the batch or noninteractive execution mode. |
NOERRORSTOP is useful if you want a batch job to continue executing SQL procedure statements after an error is encountered. |
specifies whether a statement should be executed after its syntax is checked for accuracy.
Default | EXEC |
Tip | NOEXEC is useful if you want to check the syntax of your SQL statements without executing the statements. |
See | ERRORSTOP |
specifies whether PROC SQL clears an error code for any SQL statement. Error codes are assigned to the SQLEXITCODE macro variable.
Default | 0 |
Tip | The exit code can be reset to the default value between PROC SQL statements with the RESET Statement. |
See | Using the PROC SQL Automatic Macro Variables |
specifies whether PROC SQL displays, in the SAS log, PROC SQL statements after view references are expanded or certain other transformations of the statement are made.
Default | NOFEEDBACK |
specifies that character columns longer than n are flowed to multiple lines. PROC SQL sets the column width at n and specifies that character columns longer than n are flowed to multiple lines. When you specify FLOW=n m, PROC SQL floats the width of the columns between these limits to achieve a balanced layout. Specifying FLOW without arguments is equivalent to specifying FLOW=12 200.
Default | NOFLOW |
restricts the number of rows (observations) that PROC SQL retrieves from any single source.
Tip | This option is useful for debugging queries on large tables. |
specifies whether implicit pass through is enabled or disabled.
Default | IPASSTHRU |
See | The documentation on the pass-through facility for your DBMS in SAS/ACCESS for Relational Databases: Reference. |
restricts PROC SQL to n iterations through its inner loop. You use the number of iterations reported in the SQLOOPS macro variable (after each SQL statement is executed) to discover the number of loops. Set a limit to prevent queries from consuming excessive computer resources. For example, joining three large tables without meeting the join-matching conditions could create a huge internal table that would be inefficient to execute.
See | Using the PROC SQL Automatic Macro Variables |
See DOUBLE|NODOUBLE
See EXEC|NOEXEC
See FLOW<=n <m>>|NOFLOW.
See NUMBER|NONUMBER
See PRINT|NOPRINT
See PROMPT|NOPROMPT
See STIMER|NOSTIMER
specifies whether the SELECT statement includes a column called ROW, which is the row (or observation) number of the data as the rows are retrieved.
Default | NONUMBER |
Example | Joining Two Tables |
restricts the number of rows (observations) in the output. For example, if you specify OUTOBS=10 and insert values into a table using a query expression, then the SQL procedure inserts a maximum of 10 rows. Likewise, OUTOBS=10 limits the output to 10 rows.
specifies whether the output from a SELECT statement is printed.
Default | |
Interaction | NOPRINT affects the value of the SQLOBS automatic macro variable. For more information, see Using the PROC SQL Automatic Macro Variables. |
Tip | NOPRINT is useful when you are selecting values from a table into macro variables and do not want anything to be displayed. |
modifies the effect of the INOBS=, OUTOBS=, and LOOPS= options. If you specify the PROMPT option and reach the limit specified by INOBS=, OUTOBS=, or LOOPS=, then PROC SQL prompts you to stop or continue. The prompting repeats if the same limit is reached again.
Default | NOPROMPT |
specifies the engine type to use to optimize a PUT function in a query. The PUT function is replaced with a logically equivalent expression. The engine type can be one of the following values:
specifies to consider the optimization of all PUT functions, regardless of the engine that is used by the query to access the data.
specifies to not optimize any PUT function.
specifies to consider the optimization of all PUT functions in a query performed by a SAS/ACCESS engine.
Requirement | The first argument to the PUT function must be a variable that is obtained by a table. The table must be accessed using a SAS/ACCESS engine. |
specifies to consider the optimization of all PUT functions in a query performed by a SAS/ACCESS engine or a Base SAS engine.
Default | DBMS |
Interactions | If both the REDUCEPUT= option and the CONSTDATETIME option are specified, PROC SQL replaces the DATE, TIME, DATETIME, and TODAY functions with their respective values to determine the PUT function value before the query executes. |
If the query also contains a WHERE or HAVING clause, the evaluation of the WHERE or HAVING clause is simplified. | |
Tip | Alternatively, you can set the SQLREDUCEPUT= system option. The value that is specified in the SQLREDUCEPUT= system option is in effect for all SQL procedure statements, unless the REDUCEPUT= option is set. The value of the REDUCEPUT= option takes precedence over the SQLREDUCEPUT= system option. The RESET statement can also be used to set or reset the REDUCEPUT= option. However, changing the value of the REDUCEPUT= option does not change the value of the SQLREDUCEPUT= system option. For more information, see the SQLREDUCEPUT= System Option. |
when the REDUCEPUT= option is set to DBMS, BASE, or ALL, specifies the minimum number of observations that must be in a table for PROC SQL to consider optimizing the PUT function in a query.
Default | 0, which indicates that there is no minimum number of observations in a table for PROC SQL to optimize the PUT function. |
Range | 0 – 263–1, or approximately 9.2 quintillion |
Requirement | n must be an integer |
Interaction | The REDUCEPUTOBS= option works only for DBMSs that record the number of observations in a table. If your DBMS does not record the number of observations, but you create row counts on your table, the REDUCEPUTOBS= option will work. |
Tip | Alternatively, you can set the SQLREDUCEPUTOBS= system option. The value that is specified in the SQLREDUCEPUTOBS= system option is in effect for all SQL procedure statements, unless the REDUCEPUTOBS= option is set. The value of the REDUCEPUTOBS= option takes precedence over the SQLREDUCEPUTOBS= system option. The RESET statement can also be used to set or reset the REDUCEPUTOBS= option. However, changing the value of the REDUCEPUTOBS= option does not change the value of the SQLREDUCEPUTOBS= system option. For more information, see the SQLREDUCEPUTOBS= System Option. |
when the REDUCEPUT= option is set to DBMS, BASE, or ALL, specifies the maximum number of SAS format values that can exist in a PUT function expression for PROC SQL to consider optimizing the PUT function in a query.
Default | 100 |
Range | 100 – 3,000 |
Requirement | n must be an integer |
Interaction | If the number of SAS format values in a PUT function expression is greater than this value, PROC SQL does not optimize the PUT function. |
Tips | Alternatively, you can set the SQLREDUCEPUTVALUES= system option. The value that is specified in the SQLREDUCEPUTVALUES= system option is in effect for all SQL procedure statements, unless the REDUCEPUTVALUES= option is set. The value of the REDUCEPUTVALUES= option takes precedence over the SQLREDUCEPUTVALUES= system option. The RESET statement can also be used to set or reset the REDUCEPUTVALUES= option. However, changing the value of the REDUCEPUTVALUES= option does not change the value of the SQLREDUCEPUTVALUES= system option. For more information, see SQLREDUCEPUTVALUES= System Option. |
The value for REDUCEPUTVALUES= is used for each individual optimization. For example, if you have a PUT function in a WHERE clause, and another PUT function in a SELECT statement, and both have user-defined formats with contained values, the value of REDUCEPUTVALUES= is applied separately for the clause and the statement. |
Specifies whether PROC SQL can process queries that use remerging of data. The remerge feature of PROC SQL makes two passes through a table, using data in the second pass that was created in the first pass, in order to complete a query. When the NOREMERGE system option is set, PROC SQL cannot process remerging of data. If remerging is attempted when the NOREMERGE option is set, an error is written to the SAS log.
Default | REMERGE |
Tip | Alternatively, you can set the SQLREMERGE system option. The value that is specified in the SQLREMERGE system option is in effect for all SQL procedure statements, unless the PROC SQL REMERGE option is set. The value of the REMERGE option takes precedence over the SQLREMERGE system option. The RESET statement can also be used to set or reset the REMERGE option. However, changing the value of the REMERGE option does not change the value of the SQLREMERGE system option. For more information, see SQLREMERGE System Option. |
See | Remerging Data |
Certain operations, such as ORDER BY, can sort tables internally using PROC SORT. Specifying SORTMSG requests information from PROC SORT about the sort and displays the information in the log.
Default | NOSORTMSG |
specifies the collating sequence to use when a query contains an ORDER BY clause. Use this option only if you want a collating sequence other than your system's or installation's default collating sequence.
See | SORTSEQ= option in SAS National Language Support (NLS): Reference Guide. |
specifies whether PROC SQL writes timing information to the SAS log for each statement, rather than as a cumulative value for the entire procedure. For this option to work, you must also specify the SAS system option STIMER. Some operating environments require that you specify this system option when you invoke SAS. If you use the system option alone, then you receive timing information for the entire SQL procedure, not on a statement-by-statement basis.
Default | NOSTIMER |
specifies to not insert or update a row that contains data larger than the column when a truncation error occurs. This applies only when using the SET clause in an INSERT or UPDATE statement.
overrides the SAS system option THREADS|NOTHREADS for a particular invocation of PROC SQL unless the system option is restricted. (See Restriction.) THREADS|NOTHREADS can also be specified in a RESET statement for use in particular queries. When THREADS is specified, PROC SQL uses parallel processing in order to increase the performance of sorting operations that involve large amounts of data. For more information about parallel processing, see SAS Language Reference: Concepts.
Default | value of SAS system option THREADS|NOTHREADS. |
Restriction | Your site administrator can create a restricted options table. A restricted options table specifies SAS system option values that are established at start-up and cannot be overridden. If the THREADS | NOTHREADS system option is listed in the restricted options table, any attempt to set it is ignored and a warning message is written to the SAS log. |
Interaction | When THREADS|NOTHREADS has been specified in a PROC SQL statement or a RESET statement, there is no way to reset the option to its default (that is, the value of the SAS system option THREADS|NOTHREADS) for that invocation of PROC SQL. |
specifies how PROC SQL handles updated data if errors occur while you are updating data. You can use UNDO_POLICY= to control whether your changes are permanent.
keeps any updates or inserts.
reverses any updates or inserts that it can reverse reliably.
reverses all inserts or updates that have been done to the point of the error. In some cases, the UNDO operation cannot be done reliably. For example, when a program uses a SAS/ACCESS view, it might not be able to reverse the effects of the INSERT and UPDATE statements without reversing the effects of other changes at the same time. In that case, PROC SQL issues an error message and does not execute the statement. Also, when a SAS data set is accessed through a SAS/SHARE server and is opened with the data set option CNTLLEV=RECORD, you cannot reliably reverse your changes.
Default | REQUIRED |
Tips | If you are updating a data set using the SPD Engine, you can significantly improve processing performance by setting UNDO_POLICY=NONE. However, ensure that NONE is an appropriate setting for your application. |
Alternatively, you can set the SQLUNDOPOLICY system option. The value that is specified in the SQLUNDOPOLICY= system option is in effect for all SQL procedure statements, unless the PROC SQL UNDO_POLICY= option is set. The value of the UNDO_POLICY= option takes precedence over the SQLUNDOPOLICY= system option. The RESET statement can also be used to set or reset the UNDO_POLICY= option. However, changing the value of the UNDO_POLICY= option does not change the value of the SQLUNDOPOLICY= system option. After the procedure completes, it reverts to the value of the SQLUNDOPOLICY= system option. For more information, see the SQLUNDOPOLICY= System Option. |