The example uses the pass-through CONNECT statement to establish a connection with
an ORACLE database with the specified values for the USER=, PASSWORD=, and
PATH= arguments. The CONNECTION TO component in the FROM clause of the
SELECT statement enables data to be retrieved from the database. The DBMS-specific
statement that is sent to ORACLE is enclosed in parentheses. The DISCONNECT
statement terminates the connection to ORACLE.
To store the same query in a PROC SQL, use the CREATE VIEW statement:
libname viewlib
'SAS-library';
proc sql;
connect to oracle as myconn (user=smith password=secret
path='myoracleserver');
create view viewlib.salary as
select *
from connection to myconn
(select empid, lastname, firstname, salary
from employees
where salary>75000);
disconnect from myconn;
quit;
ACCESS Procedure and Interface View Engine
The ACCESS procedure enables you to create access descriptors, which are SAS files of
member type ACCESS. They describe data that is stored in a DBMS in a format that
SAS can understand. Access descriptors enable you to create SAS/ACCESS views,
called view descriptors. View descriptors are files of member type VIEW that function
in the same way as SAS views that are created with PROC SQL, as described in
“Embedding a SAS/ACCESS LIBNAME Statement in a PROC SQL View” on page 710
and “SQL Procedure Pass-Through Facility” on page 711.
Note: If a dynamic LIBNAME engine is available for your DBMS, it is recommended
that you use the SAS/ACCESS LIBNAME statement to access your DBMS data
instead of access descriptors and view descriptors. However, descriptors continue to
work in SAS software if they were available for your DBMS in SAS 6. Some new
SAS features, such as long variable names, are not supported when you use
descriptors.
The following example creates an access descriptor and a view descriptor in the same
PROC step to retrieve data from a DB2 table:
libname adlib 'SAS-library';
libname vlib 'SAS -library';
proc access dbms=db2;
create adlib.order.access;
table=sasdemo.orders;
assign=no;
list all;
712 Chapter 33 About SAS/ACCESS Software

Get SAS 9.4 Language Reference, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.