Tuesday, January 19, 2016

Formats

It has been a really long time since I posted an entry on this blog, I am working on using existing formats and create new custom formats in SAS and thought this would be a good topic to write on.

In SAS, values can be displayed using either the generic formats available or create custom formats. The FORMAT procedure is used to create custom formats. The custom formats can be stored either temporarily (active only in the current SAS program) or stored permanently so they can reused as needed.

Some of the generic formats available in SAS

  • MMDDYYs.                                 01/16/2016
  • dollar11.2                                     $243,678.25


PROC FORMAT
General Form
        PROC FORMAT ;

where options include
  •  LIBRARY= libref  specifies the libref for a SAS data library to contain a permanent catalog of user-defined formats
  • FMTLIB  displays a list of all of the formats in your catalog, along with descriptions of their values.
Use the Library= option to store the format in a permanent format catalog.

PROC FORMAT LIBRARY=libref;
 Remember to associate the libref to the SAS data library where format catalog is stored

libname custom 'c:/sas/formats/lib';


Now formats created as below will be stored in the permanent format catalog called custom.formats

libname custom 'c:/sas/formats/lib';

proc format library=custom;
.............;
run;