Long-time SAS© 9 users are increasingly looking to migrate to SAS© Viya™ to harness the power of the CAS (Cloud Analytic Services) engine. This distributed and in-memory engine can significantly speed up existing processes and analyze massive data volumes.
However, a key step in this modernization involves updating PROC SQL code to a CAS-native procedure: PROC FedSQL. While powerful, this transition can be confusing due to strict syntactic differences between the two languages.
This article explores the fundamental differences and provides a practical guide to adapting your code without errors.
1. Understanding the Architecture: Compute vs. CAS
Before modifying the code, it's crucial to understand where it runs:
SAS© Compute Server: This is the equivalent of the SAS© 9 Workspace Server. Your existing SAS© 9 code (and
PROC SQL) works here without modification.SAS© Cloud Analytic Services (CAS): The new high-performance engine. For a procedure to run here, the data must be loaded into memory and the code adapted.
2. PROC SQL vs. PROC FedSQL: The Major Differences
The main difference lies in the SQL standard used. While PROC SQL is permissive (SAS© extensions), PROC FedSQL is strict (ANSI-1999).
Table 1: Feature Comparison
| Characteristic | PROC SQL (SAS© 9 / Compute) | PROC FedSQL (SAS© Viya™ / CAS) |
| Execution Engine | SAS© Compute Server | CAS (Cloud Analytic Services) |
| SQL Standard | ANSI-1992 (Partial) + SAS© Extensions | ANSI-1999 (Strict) |
| Architecture | Single-threaded (except sort/index) | Parallel, Distributed, In-Memory |
| Data Types | Standard (Char, Numeric) | Extended (VARCHAR, INT64, DOUBLE, VARBINARY...) |
| Federated Queries | No (1 DB connection per query) | Yes (Multi-source joins possible) |
| Error Handling | Frequent stop on error | NOERRORSTOP option available to continue |
3. Which Procedure to Use and Where?
A common confusion concerns the location of data (Local Libraries vs. Caslibs). To run FedSQL on CAS, the sessref= option is mandatory.
Table 2: Decision Matrix
| Data Source (Input) | Data Target (Output) | Procedure to Use | Technical Note |
| Compute (e.g., Base SAS©, Work) | Compute | PROC SQL (or FedSQL without sessref) | Classic SAS© 9 approach. |
| Compute | CAS | PROC SQL | FedSQL on CAS cannot "see" local libnames (Compute). |
| CAS | Compute | PROC SQL | Data is downloaded from the CAS server to the client (slow for large volumes). |
| CAS | CAS | PROC FedSQL (with sessref) | The only method to benefit from distributed in-memory processing. |