The FORMAT Procedure |
This section discusses options that are valid in the INVALUE, PICTURE, and VALUE statements. These options appear in parentheses after the informat or format name. They affect the entire informat or format that you are creating.
specifies the default length of the informat or format. The value for DEFAULT= becomes the length of the informat or format if you do not give a specific length when you associate the informat or format with a variable.
The default length of a format is the length of the longest formatted value.
The default length of an informat depends on whether the informat is character or numeric. The default length of character informats is the length of the longest informatted value. The default of a numeric informat is 12 if you have numeric data to the left of the equal sign. If you have a quoted string to the left of the equal sign, then the default length is the length of the longest string.
specifies a fuzz factor for matching values to a range. If a number does not match or fall in a range exactly but comes within fuzz-factor, then the format considers it a match. For example, the following VALUE statement creates the LEVELS. format, which uses a fuzz factor of .2:
value levels (fuzz=.2) 1='A' 2='B' 3='C';
FUZZ=.2 means that if a variable value falls within .2 of a value on either end of the range, then the format uses the corresponding formatted value to print the variable value. So the LEVELS. format formats the value 2.1 as B.
If a variable value matches one value or range without the fuzz factor, and also matches another value or range with the fuzz factor, then the format assigns the variable value to the value or range that it matched without the fuzz factor.
Default: | 1E-12 for numeric formats and 0 for character formats. |
Tip: | Specify FUZZ=0 to save storage space when you use the VALUE statement to create numeric formats. |
Tip: | A value that is excluded from a range using the < operator does not receive the formatted value, even if it falls into the range when you use the fuzz factor. |
specifies a maximum length for the informat or format. When you associate the format with a variable, you cannot specify a width greater than the MAX= value.
Default: | 40 |
Range: | 1-40 |
specifies a minimum length for the informat or format.
Default: | 1 |
Range: | 1-40 |
stores values or ranges for informats or formats in the order in which you define them. If you do not specify NOTSORTED, then values or ranges are stored in sorted order by default, and SAS uses a binary searching algorithm to locate the range that a particular value falls into. If you specify NOTSORTED, then SAS searches each range in the order in which you define them until a match is found.
Use NOTSORTED if one of the following is true:
you know the likelihood of certain ranges occurring, and you want your informat or format to search those ranges first to save processing time.
you want to preserve the order that you define ranges when you print a description of the informat or format using the FMTLIB option.
you want to preserve the order that you define ranges when you use the ORDER=DATA option and the PRELOADFMT option to analyze class variables in PROC MEANS, PROC SUMMARY, or PROC TABULATE.
Do not use NOTSORTED if the distribution of values is uniform or unknown, or if the number of values is relatively small. The binary searching algorithm that SAS uses when NOTSORTED is not specified optimizes the performance of the search under these conditions.
Note: SAS automatically sets the NOTSORTED option when you use the CPORT and the CIMPORT procedures to transport informats or formats between operating environments with different standard collating sequences. This automatic setting of NOTSORTED can occur when you transport informats or formats between ASCII and EBCDIC operating environments. If this situation is undesirable, then do the following:
Use the CNTLOUT= option in the PROC FORMAT statement to create an output control data set.
Use the CPORT procedure to create a transport file for the control data set.
Use the CIMPORT procedure in the target operating environment to import the transport file.
In the target operating environment, use PROC FORMAT with the CNTLIN= option to build the formats and informats from the imported control data set.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.