Overview
SAS enables you to create user-defined formats that execute instructions for displaying data values. For example, you might create a format that spells out an abbreviation, or that changes a numeric code to a more easily understood character string. To make existing user-defined formats available for use in clients such as SAS® Visual Analytics, SAS® Information Map Studio, and SAS® Data Integration Studio, store a copy of your format catalog in a file location that is accessible to the SAS® Application Server that is being used by those applications.
For example, if you are using the default SAS Application Server (named SASApp) and your catalog is named formats.sas7bcat, then you simply place a copy of formats.sas7bcat in SAS-config-dir/Lev1/SASApp/SASEnvironment/SASFormats.
This article contains the following topics:
Specifying a format catalog with a different name in the default location
Referencing additional format catalogs in the default location
Specifying additional catalog locations
Changing the default format catalog location
Referencing a user-defined format configuration file
Note: For more information about SAS system options, how to create a format catalog, how to apply formats to your data, and managing format catalogs on multiple machines, see Additional resources.
There are two related configuration files for the workspace server: sasv9.cfg and sasv9_usermods.cfg. If you are using the default SAS Application Server, these files are located in a directory such as <sas-config-dir>/Lev1/SASApp/.
In the initial configuration, the sasv9.cfg file includes the following lines:
-set APFMTLIB "SASEnvironment/SASFormats"
-insert fmtsearch APFMTLIB
The SET system option assigns the default libref (APFMTLIB) and the relative path to the storage location (SASEnvironment/SASFormats) for the format catalogs. The FMTSEARCH system option specifies to search for the format catalog in the location identified by SET system option. Since the FMTSEARCH option does not specify a catalog name, SAS assumes the catalog in APFMTLIB is named formats.sas7bcat.
Do not make changes directly to the sasv9.cfg file. Instead, as explained in this note, use the sasv9_usermods.cfg file to override the default settings.
If the catalog that you are storing in the default location is not named formats, then you can easily specify a different catalog name. For example, suppose that your catalog is named usrfmt. Here are the steps to point to usrfmt:
-insert fmtsearch APFMTLIB.usrfmt
3. Save the file.
4. Restart the object spawner.
Note: If SAS is running on a UNIX server, you must enter your libref using uppercase letters. For example, APFMTLIB must be all uppercase.
Referencing Additional Format Catalogs in the Default Location
Your default location can contain catalogs in addition to the one named formats. For example, suppose that your default location also contains catalogs named format2 and format3. Here are the steps to reference those catalogs:
1. Place a copy of each catalog in the directory identified by the SET option in the sasv9.cfg file.
2. Locate the sasv9_usermods.cfg file for the workspace server, and open the file in a plain text editor.
3. Add the following line to point to your other format catalogs:
-insert fmtsearch (APFMTLIB.format2 APFMTLIB.format3)
4. Save the file.
5. Restart the object spawner.
Note: If SAS is running on a UNIX server, you must enter your libref using uppercase letters. For example, APFMTLIB must be all uppercase.
You can specify format locations in addition to the default location. For example, suppose that you also store format catalogs in C:\SAS\Config\Lev1\SASApp\MoreFormats. Here are the steps to point to catalogs in that additional location:
-set FMTLOC2 "C:\SAS\Config\Lev1\SASApp\MoreFormats"
-insert fmtsearch (APFMTLIB FMTLOC2)
3. (Conditional) If the catalog in the new location is not named formats, then append the name of the catalog to the libref. For example, if your catalog in FMTLOC2 is named usrfmt, then enter:
-set FMTLOC2 "C:\SAS\Config\Lev1\SASApp\MoreFormats"
-insert fmtsearch (APFMTLIB FMTLOC2.usrfmt)
4. Save the file.
5. Restart the object spawner.
Note: If SAS is running on a UNIX server, you must enter your libref using uppercase letters. For example, APFMTLIB and FMTLOC2 must be all uppercase.
Changing the Default Format Catalog Location
You do not have to store your catalogs in the location specified by the SET option in the sasv9.cfg file, as long as the new location is still accessible to the SAS Application Server used by the clients. For example, suppose that your catalogs are stored in C:\SAS\Config\Lev1\SASApp\MoreFormats. Here are the steps to use the same default libref (APFMTLIB) but point to your preferred location instead of the default location:
1. Locate the sasv9_usermods.cfg file for the workspace server, and open the file in a plain text editor.
2. Add the following lines. For the SET system option, specify the default libref (APFMTLIB) and the fully qualified path to the preferred catalog location. Include the FMTSEARCH option to point to APFMTLIB.
-set APFMTLIB "C:\SAS\Config\Lev1\SASApp\MoreFormats"
-insert fmtsearch APFMTLIB.usrfmt
3. (Conditional) If the catalog in the new location is not named formats, then append the name of the catalog to the libref. For example, if your catalog in APFMTLIB is named usrfmt, then enter:
-set APFMTLIB "C:\SAS\Config\Lev1\SASApp\MoreFormats"
-insert fmtsearch APFMTLIB.usrfmt
If you have more than one catalog in the new location, then use this form:
-set APFMTLIB "C:\SAS\Config\Lev1\SASApp\MoreFormats"
-insert fmtsearch (APFMTLIB.usrfmt APFMTLIB.usrfmt2)
4. Save the file.
5. Restart the object spawner.
Note: If SAS is running on a UNIX server, you must enter your libref using uppercase letters. For example, APFMTLIB must be all uppercase.
Referencing a User-Defined Format Configuration File
Instead of specifying the location of your format catalogs directly in the sasv9_usermods.cfg file, you can point to a .cfg file that contains the location of your catalogs. For example, suppose that you have a format catalog named newcat. The catalog is located in C:\SAS\Config\Lev1\SASApp\MoreFormats. You want to use the libref FMTLOC2. Here are the steps to use a .cfg file to point to that catalog:
-set FMTLOC2 "C:\SAS\Config\Lev1\SASApp\MoreFormats"
-insert fmtsearch (FMTLOC2.newcat)
2. Save the file with a .cfg extension. For example, you might name it fmtfile.cfg.
3. Locate the sasv9_usermods.cfg file for the workspace server, and open the file in a plain text editor.
4. Add the following line to point to the .cfg file.
-config "C:\SAS\Config\Lev1\SASApp\MoreFormats\fmtfile.cfg"
Note: On UNIX systems, do not include the quotation marks around the file path.
5. Save the file.
6. Restart the object spawner.
Note: If SAS is running on a UNIX server, you must enter your libref using uppercase letters. For example, FMTLOC2 must be all uppercase.