The CONNECTION TO component
specifies the DBMS connection that you want to use or that you want
to create (if you have omitted the CONNECT statement). CONNECTION
TO then enables you to retrieve DBMS data directly through a PROC
SQL query.
You use the CONNECTION
TO component in the FROM clause of a PROC SQL SELECT statement:
PROC SQL;
SELECT
column-list
FROM CONNECTION TO dbms-name
(dbms-query)other optional PROC SQL clauses
QUIT;
You can use CONNECTION
TO in any FROM clause, including those in nested queries—that
is, subqueries.
You can store an SQL
pass-through facility query in an SQL view and then use that view
in SAS programs. When you create an SQL view, any options that you
specify in the corresponding CONNECT statement are stored too. So
when the SQL view is used in a SAS program, SAS can establish the
appropriate connection to the DBMS.
On many relational databases,
you can issue a CONNECTION TO component in a PROC SQL SELECT statement
directly without first connecting to a DBMS. (See
CONNECT Statement.) If you omit the CONNECT statement, an implicit connection
is performed when the first PROC SQL SELECT statement that contains
a CONNECTION TO component is passed to the DBMS. Default values are
used for all DBMS connection arguments. See the documentation for
your SAS/ACCESS
interface for details.
Because relational databases
and SAS have different naming conventions, some DBMS column names
might be changed when you retrieve DBMS data through the CONNECTION
TO component.
See SAS Names and Support for DBMS Names for more information.