SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Formatting Variable Values
Creating User-Defined Formats


The FORMAT procedure begins with the PROC FORMAT statement.


General form, PROC FORMAT statement:
PROC FORMAT <options>;

where options include

  • LIBRARY=libref specifies the libref for a SAS data library that contains a permanent catalog in which user-defined formats are stored
  • FMTLIB displays the contents of a format catalog.


Any time that you create a format by using PROC FORMAT, the format is stored in a format catalog. If the SAS library does not already contain a format catalog, SAS software automatically creates one. If you do not specify the LIBRARY= option, the formats are stored in a default format catalog named Work.Formats.

As the libref Work implies, any format stored in Work.Formats is a temporary format that exists only for the current SAS session. At the end of the current session, the formats are erased.


Permanently Storing Your Formats

You can store your formats in a permanent format catalog named Formats when you specify the LIBRARY= option in the PROC FORMAT statement.

           PROC FORMAT LIBRARY=libref;

But first, you need a LIBNAME statement that associates the libref with the permanent SAS data library where the format catalog is to be stored. It is recommended, but not required, that you use the word Library as the libref when creating your own permanent formats.

     libname library 'c:\sas\formats\lib';
     libname library 'c:\data\setup\library';
     libname library 'c:\sales\ancillary\libset';

However, when you associate a permanent format with a variable in a subsequent DATA or PROC step, you must reference the location of the format catalog by using the Library libref.

We'll discuss applying permanent user-defined formats later, after you learn how to create them.


back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement