Programming Documentation SAS VIYA CAS

The Brain Behind the Cloud: How SAS Macros Drive CAS Performance

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

Expert Advice

Michael
Responsable de l'infrastructure Viya.

Since macros execute in the SAS session (Compute Server) and not on the CAS server, you cannot use a macro variable to track the progress of a CAS action while it is running.

To bridge this gap, always use the &SYSCC macro variable or the _status dictionary generated by CAS actions. The macro language waits for CAS to finish its job, receives a return code, and then decides what text to generate next. If your macro logic depends on data values inside a CAS table, you must first use an action like table.fetch to bring those values back to the SAS session before the macro can "see" them.

The "Macro-to-CAS" Handshake
Understanding that the SAS Macro language is a text preprocessor is the secret to debugging in Viya.
The Macro language is fully supported in the SAS© Viya platform, but its execution is limited to the SAS© session. Macros are particularly useful for dynamically generating SAS© code that will then be submitted and executed on the CAS server. It is important to note that the macro language itself does not execute directly on the CAS server, but acts as a preprocessor to produce code executable by CAS. This functionality allows great flexibility to automate the creation of complex programs and queries interacting with CAS's distributed processing capabilities.