| Formatting Variable Values |
| Creating User-Defined
Formats |
| Now, any format you create in this PROC FORMAT step is stored in a permanent format catalog called Library.Formats. |
libname library 'c:\sas\formats\lib';
proc format library=library
. . .;
run;
|
| In the program above, the catalog Library.Formats is
located in the SAS library
Notice that LIB= is an acceptable abbreviation for the LIBRARY= option. proc format lib=library; Also notice that you can specify a catalog name in the LIBRARY= option, and store formats in any catalog you want. The catalog name must adhere to SAS naming conventions. proc format lib=library.catalog; Now that you know how to store your own formats, let's see how to create them.
The VALUE statement defines a format for displaying one or more values. |
General form, VALUE statement:
where the format's name
|
Notice that the statement begins with the keyword VALUE and ends with
a semicolon after all the labels have been defined. For example, this single
VALUE statement creates the JobFmt format, which assigns a label to each
possible value for the variable JobTitle.
proc format lib=library;
value JobFmt
103='manager'
105='text processor'
111='assoc. technical writer'
112='technical writer'
113='senior technical writer';
run;
|
| FirstName | LastName | JobTitle | Salary |
| Donny | Evans | 112 | 29996.63 |
| Lisa | Helms | 105 | 18567.23 |
| John | Higgins | 111 | 25309.00 |
| Amy | Larson | 113 | 32696.78 |
| Mary | Moore | 112 | 28945.89 |
| Jason | Powell | 103 | 35099.50 |
![]() ![]() |
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.