Page 49 - SAS_manual
P. 49
5.4 Storing Your Formats in a Format Library
As we mentioned earlier, if you place LABEL and FORMAT statements in the DATA step, the labels and
formats become permanently associated with their respective variables. If you have user-defined formats
with permanent SAS data sets, it is important to make your formats permanent also. Here are the steps to
do this:
Create a library reference (libref) to indicate where you want to store your SAS formats. This can be
the same library where you store your data sets.
Use the option LIBRARY=librefwhen you run PROC FORMAT.
Syntax :
libnamesasbook 'd:\books\sas\formats';
proc format library=sasbooks;
5.5 Accessing a Permanent SAS Data Set with User-Defined
Formats
If you want to use a permanent SAS data set that has user-defined formats, the only requirement is to
remember to tell SAS where to find the formats. If you forget the FMTSEARCH= system option, you will
get an error message telling you that SAS cannot find the formats.
If we have more than one library then through this syntax you set your format
Libraries:
libname learn 'd:\books\learning';
libnamesasbook 'd:\books\sasbook\formats';
Syntax:
optionsfmtsearch=(myfmts);
5.6 Displaying Your Format
A useful PROC FORMAT option is FMTLIB. This option creates a listing of each format in the specified
library with the ranges and labels.
SAS HANDBOOK | VISIT:: http://nikhilanalytics.com 49