Previous Page | Next Page

Interfaces with the Macro Facility

Interfaces with the SQL Procedure


Using PROC SQL

Structured Query Language (SQL) is a standardized, widely used language for retrieving and updating data in databases and relational tables. SAS software's SQL processor enables you to do the following:


INTO Clause

SQL provides the INTO clause in the SELECT statement for creating SAS macro variables. You can create multiple macro variables with a single INTO clause. The INTO clause follows the same scoping rules as the %LET statement. See Macro Variables for a summary of how macro variables are created. For further details and examples relating to the INTO clause, see INTO Clause.


Controlling Job Execution

PROC SQL also provides macro tools to do the following:

The following table provides information about macro variables created by SQL that affect job execution.

Macro Variables that Affect Job Execution
Macro Variable Description
SQLEXITCODE contains the highest return code that occurred from some types of SQL insert failures. This return code is written to the SYSERR macro variable when PROC SQL terminates.
SQLOBS contains the number of rows or observations produced by a SELECT statement.
SQLOOPS contains the number of iterations that the inner loop of PROC SQL processes.
SQLRC contains the return code from an SQL statement. For return codes, see SAS SQL documentation.
SQLXMSG contains descriptive information and the DBMS-specific return code for the error that is returned by the Pass-Through Facility.
SQLXRC contains the DBMS-specific return code that is returned by the Pass-Through Facility.

Previous Page | Next Page | Top of Page