Session vs. Global: Mastering User-Defined Format Scopes in SAS Viya

This code is also available in: Deutsch Español Français
Michael

Expert Advice

Michael
Responsable de l'infrastructure Viya.

In SAS Viya, user-defined formats are no longer just simple catalog entries; they must exist in the right memory space to work correctly.

The "Split Brain" Risk: A format stored only in a local SAS catalog (on the Compute Server) will work fine for PROC PRINT, but will fail (display raw values) if you try to use it inside a CAS action (like cardinality.summarize).

The Solution: You must explicitly load your formats into a CAS Format Library. This pushes the mapping logic up to the CAS server, allowing distributed worker nodes to apply the labels during parallel processing.

Scope Matters: By default, a format loaded into CAS is "Session-Scope" (visible only to you, for now). Use the promote action to make it "Global-Scope," ensuring other users and scheduled jobs can see the same data definitions without reloading them.

Understand where your formats live: Compute vs. CAS.
On the SAS© Viya platform, user-defined formats can be managed in two primary ways: either stored in traditional catalogs for use within a SAS© session, or in a format library on the CAS server. CAS format libraries are associated with a specific CAS session, or can be promoted to a global scope, making them accessible to all CAS sessions. These server-side user-defined formats are essential for executing analyses where formatted values play a critical role. The documentation also mentions the possibility of migrating existing user-defined formats from SAS© to the SAS© Viya platform, offering flexibility for integrating existing systems.