SAS Institute. The Power to Know

SAS/ACCESS(R) 9.2 Interface to PC Files: Reference

space
Previous Page | Next Page

The Pass-Through Facility for PC Files on Microsoft Windows

Syntax for the Pass-Through Facility for PC Files

This section presents the syntax for the Pass-Through Facility statements and the CONNECTION TO component, which can be used in conjunction with the PROC SQL SELECT statement to query data from a data source.

PROC SQL <options-list>;
CONNECT TO data-source-name <AS alias> <(<connect-statement-arguments> <database-connection-arguments>)>;
DISCONNECT FROM <data-source-name | alias>;
EXECUTE (data-source-specific-SQL-statement) BY data-source-name | alias;
SELECT * FROM CONNECTION TO data-source-name | alias (data-source-query)

Return Codes

As you use the PROC SQL statements that are available in the Pass-Through Facility, any error conditions are written to the SAS log. The Pass-Through Facility generates return codes and messages that are available to you through the following two SAS macro variables:

SQLXRC

contains the data source return code that identifies the data source error.

SQLXMSG

contains descriptive information about the data source error that is generated by the data source.

The contents of the SQLXRC and SQLXMSG macro variables are printed in the SAS log using the %PUT macro. They are reset after each Pass-Through Facility statement has been executed.


Example

To connect to an Excel file and query the INVOICE table (range) within the Excel workbook:

PROC SQL DQUOTE=ANSI;
CONNECT TO EXCEL (PATH="c:\sasdemo\sasdemo.xls");
SELECT * FROM CONNECTION TO EXCEL
   (SELECT * FROM INVOICE);
DISCONNECT FROM EXCEL; 
QUIT; 

space
Previous Page | Next Page | Top of Page