Administration SAS9

Understanding and Configuring SAS PC Files Server for 64-bit and Unix/Linux Environments

Simon 12 vues
Niveau de difficulté
Débutant
Publié le :

Accessing Microsoft Office files (Excel, Access) from SAS© can be complex when working in a 64-bit environment or on non-Windows operating systems (like Linux or Unix).

In these configurations, the traditional use of ODBC engines or DDE links is often not straightforward. The solution lies in using the SAS© PC Files Server combined with the DBMS=EXCELCS option. This article summarizes the prerequisites, syntax, and points of caution identified by the user community.

1. The Concept: Why a "PC Files Server"?

If your main SAS© server runs on a Unix or Linux-type operating system (often called a "real OS" by purists), it cannot natively communicate with the Microsoft drivers (JET or ACE) required to read .xls, .xlsx, or .mdb files.

As confirmed by technical discussions, you must have a separate Windows machine.

  • The Role of the PC Files Server: It is installed on this intermediate Windows machine. It acts as a bridge.

  • The Flow: Your SAS© (on Linux/Unix) sends a request to the PC Files Server (on Windows), which queries the Excel/Access file via local drivers, and returns the data to SAS©.

Important Note: If you do not have access to any Windows machine in your infrastructure to host this component, this solution cannot be implemented.

Note :
To interact with this remote server, the EXCELCS engine is used in import and export procedures.

Example of SAS© code
Here is the standard structure for exporting and importing data via the PC Files Server:
1/* Export vers Excel */
2PROC EXPORT
3 DATA = ma_lib.mon_dataset
4 OUTFILE = "C:\Chemin\Vers\Fichier.xlsx" /* Chemin sur le serveur Windows */
5 DBMS = EXCELCS
6 REPLACE;
7 SERVER = "NomDuServeurWindows"; /* ou adresse IP */
8 PORT = 9621; /* Port par défaut, à vérifier */
9 SSPI = YES; /* Authentification Windows intégrée */
10RUN;
11 
12/* Import depuis Excel */
13PROC IMPORT
14 OUT = ma_lib.mon_dataset_import
15 DATAFILE = "C:\Chemin\Vers\Fichier.xlsx"
16 DBMS = EXCELCS
17 REPLACE;
18 SERVER = "NomDuServeurWindows";
19 PORT = 9621;
20 SSPI = YES;
21RUN;
DBMS=EXCELCS: Specifies that the Client/Server model is used to access PC files.

SERVER= and PORT=: Indicate the location of the PC Files Server.

SSPI=YES: Enables Integrated Windows Authentication, often avoiding the need to hard-code passwords.

3. Points of Caution and Limitations

When implementing this solution, several technical pitfalls have been identified (based on SAS© Usage Notes 35064 and 41060):

  • Windows Service and Network Drives: If the SAS© PC File Server is installed as a Windows Service, it may not recognize mapped network drives. It is often necessary to use UNC paths (e.g., \\server\share\file.xlsx) or to check the permissions of the account running the service.

  • Unsupported Options: Unlike classic import engines, the EXCELCS and PCFILES engines may not support certain practical options like GETNAMES= or MIXED=. You must be careful about the structure of your source Excel files.

4. Documentation and Installation

For installation and advanced configuration (especially for administrators), it is recommended to refer to the official documentation:

  • SAS©/ACCESS(R) Interface to PC Files: Reference.

  • Specifically consult the sections on the "LIBNAME Statement", the "Pass-Through Facility" for Linux/Unix, and the "PC Files Server Administration" chapter.

The SAS© PC Files Server is an essential tool for interoperability between robust SAS© environments (Unix/Linux 64-bit) and the Windows office world. Although it requires a mixed infrastructure (a dedicated Windows machine is required), it offers a standardized method via DBMS=EXCELCS to automate data flows.