![](https://pdfstore-manualsonline.prod.a.ki/pdfasset/b/da/bda6fccb-b246-43e7-a520-a01ed647b8cf/bda6fccb-b246-43e7-a520-a01ed647b8cf-bgf4.png)
234 EXECUTE Statement Chapter 12
quit;
EXECUTE Statement
Sends DBMS-specific, non-query SQL statements to the DBMS
Valid in: PROC SQL steps (when accessing DBMS data using SAS/ACCESS software)
Syntax
EXECUTE (dbms-specific-sql-statement)BYdbms-name | alias;
The EXECUTE statement sends dynamic non-query, DBMS-specific SQL statements
to the DBMS and processes those statements.
In some SAS/ACCESS interfaces, you can issue an EXECUTE statement directly
without first explicitly connecting to a DBMS (see
“CONNECT Statement” on page 228). If you omit the CONNECT statement, an implicit
connection is performed (by using default values for all database connection arguments)
when the first EXECUTE statement is passed to the DBMS. See the documentation for
your SAS/ACCESS interface for details.
The EXECUTE statement cannot be stored as part of an Pass-Through Facility query
in a PROC SQL view.
Arguments
(dbms-specific-sql-statement)
a dynamic non-query, DBMS-specific SQL statement. This argument is required
and must be enclosed in parentheses. However, the SQL statement cannot contain
a semicolon because a semicolon represents the end of a statement in SAS. The
SQL statement may be case-sensitive, depending on your DBMS, and it is passed
to the DBMS exactly as you type it.
On some DBMSs, this argument can be a DBMS stored procedure. However,
stored procedures with output parameters are not supported in the Pass-Through
Facility. Further, if the stored procedure contains more than one query, only the
first query is processed.
Any return code or message that is generated by the DBMS is available in the
macro variables SQLXRC and SQLXMSG after the statement executes. See
“Macro Variables for Relational Databases” on page 219 for more information on
these macro variables.
dbms-name
identifies the database management system to which you direct the DBMS-specific
SQL statement. The keyword BY must appear before the dbms-name argument.
You must specify either the DBMS name for your SAS/ACCESS interface or an
alias.
alias
specifies an alias that was defined in the CONNECT statement. (You cannot use
an alias if the CONNECT statement was omitted.)