If a CAS table has columns which reference user-defined formats, the formats must be made available to the CAS server. CAS cannot directly read SAS catalogs that store user-defined formats. They must be converted to a CAS format library and stored in a sashdat file in a path based CASLIB. In addition, to be made available to all users, the CAS format library must be promoted in a global CASLIB.
In SAS Viya 3.4 we have some new functionality to make it easier to manage the availability of user-defined formats in both Environment Manager and the command-line interfaces.
Firstly, let's look at the new out-of-the-box configuration for user-defined formats. The standard install sets up:
The CASLIB and CAS Format library are made available by being defined in the casstartup.lua file. This file runs when the CAS server starts. It is not recommended to make any changes to casstartup.lua (use casstartup_usermods.lua) or to load your own formats to sassuppliedformats. These files may be changed during a software update or upgrade.
In SAS Viya 3.4 in SAS Environment Manager you must be a SAS Administrator to manage user defined formats. An administrator can manage formats in existing format libraries including:
The ability to import formats from a sashdat table and directly from a SAS catalog is new in SAS Viya 3.4. The addition of the ability to import formats from a SAS catalog is a great new feature.
In addition, if a user is also a CAS administrator, and if they assume the super user role in SAS Environment Manager they can manage CAS format libraries. In SAS Viya 3.4 SAS Environment Manager a CAS administrator can:
The short video below will demo how to:
The approach in the video is useful if you want to view the formats your are importing, and compare them to existing formats. In addition you don't need to be a CAS administrator to do the second step, importing the formats. This means that you can split the functionality so that only a CAS administrator can manage format libraries but other administrators can manage formats within the libraries.
An alternative approach, creates the CAS format library and imports the formats from a supported file all in one step.
This method is more efficient when you have a lot of formats in your catalogs, but you don't get a chance to see the formats, and you do have to be a CAS administrator.
The ability to make these changes in SAS Environment manager is a great improvement. However, you should be aware that the only way to persist the availability of user-defined formats across server restarts is to modify the cassstartup_usermods.lua file to:
The image below shows the code to load the CAS format library into memory and add it to the search order in casstartup_usermods.lua. This file is runs every time the CAS server starts.
Making these changes will ensure that the CAS Format library is loaded into memory, and added to the formats search order every time the CAS Server starts. The format search order is used during session startup to automatically established format libraries to search when a table a format is needed.
In SAS Viya 3.4 the CAS plug-in to the sas-admin command-line interface has been enhanced to allow the administrator to create format libraries, update the format search order and import formats. The command-below perform all these tasks, however, the CLI also does not persist the changes, the only way to persist the changes is to include them in CAS server startup processing.
./sas-admin cas format-libraries create --server cas-shared-default --format-library hrformats --search-order prepend --source-path /gelcontent/gelcorp/hr/formats/formats.sas7bcat --su
These changes give the SAS Viya administrator more choices for how they will make user-defined formats available to CAS in SAS Viya 3.4.
For more information check out the User Defined formats section in the Viya Administration Guide h
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.