FORMAT Procedure

Results: FORMAT Procedure

Output Control Data Set

The output control data set contains information that describes informats or formats. Output control data sets have a number of uses. For example, an output control data set can be edited with a DATA step to programmatically change value ranges or can be subset with a DATA step to create new formats and informats. In addition, you can move formats and informats from one operating environment to another by creating an output control data set, using the CPORT procedure to create a transfer file of the data set, and then using the CIMPORT and FORMAT procedures in the target operating environment to create the formats and informats there.
You create an output control data set with the CNTLOUT= option in the PROC FORMAT statement. You use output control data sets, or a set of observations from an output control data set, as an input control data set in a subsequent PROC FORMAT step with the CNTLIN= option.
Output control data sets contain an observation for every value or range in each of the informats or formats in the LIBRARY= catalog. The data set consists of variables that give either global information about each format and informat created in the PROC FORMAT step or specific information about each range and value.
The variables in the output control data set are as follows:
DEFAULT
specifies a numeric variable that indicates the default length for format or informat.
END
specifies a character variable that gives the range's ending value.
EEXCL
specifies a character variable that indicates whether the range's ending value is excluded. Valid values are as follows:
Y
specifies that the range's ending value is excluded.
N
specifies that the range's ending value is not excluded.
FILL
for picture formats, specifies a numeric variable whose value is the value of the FILL= option.
FMTNAME
specifies a character variable whose value is the format or informat name.
FUZZ
specifies a numeric variable whose value is the value of the FUZZ= option.
HLO
specifies a character variable that contains range information about the format or informat. The following valid values can appear in any combination:
F
specifies a standard SAS format or informat that is used with a value.
H
specifies that a range's ending value is HIGH.
I
specifies a numeric informat range.
J
specifies justification for an informat.
L
specifies that a range's starting value is LOW.
M
specifies that the MULTILABEL option is in effect.
N
specifies that the format or informat has no ranges, including no OTHER= range.
O
specifies that the range is OTHER.
R
specifies that the ROUND option is in effect.
S
specifies that the NOTSORTED option is in effect.
U
specifies that the UPCASE option for an informat be used.
LABEL
specifies a character variable whose value is associated with a format or an informat.
LENGTH
specifies a numeric variable whose value is the value of the LENGTH= option.
MAX
specifies a numeric variable whose value is the value of the MAX= option.
MIN
specifies a numeric variable whose value is the value of the MIN= option.
MULT
specifies a numeric variable whose value is the value of the MULT= option.
NOEDIT
for picture formats, specifies a numeric variable whose value indicates whether the NOEDIT option is in effect. Valid values are as follows:
1
specifies that the NOEDIT option is in effect.
0
specifies that the NOEDIT option is not in effect.
PREFIX
for picture formats, specifies a character variable whose value is the value of the PREFIX= option.
SEXCL
specifies a character variable that indicates whether the range's starting value is excluded. Valid values are as follows:
Y
specifies that the range's starting value is excluded.
N
specifies that the range's starting value is not excluded.
START
specifies a character variable that gives the range's starting value.
TYPE
specifies a character variable that indicates the type of format. Possible values are as follows:
C
specifies a character format.
I
specifies a numeric informat.
J
specifies a character informat.
N
specifies a numeric format (excluding pictures).
P
specifies a picture format.
The following output shows an output control data set that contains information about all the informats and formats created in the FORMAT procedure examples.
Output Control Data Set for PROC FORMAT Examples
Output Control Data Set for PROC FORMAT Examples
You can use the SELECT or EXCLUDE statement to control which formats and informats are represented in the output control data set. For details, see SELECT Statement and EXCLUDE Statement.

Input Control Data Set

You specify an input control data set with the CNTLIN= option in the PROC FORMAT statement. The FORMAT procedure uses the data in the input control data set to construct informats and formats. Thus, you can create informats and formats without writing INVALUE, PICTURE, or VALUE statements.
The input control data set must have these characteristics:
  • For both numeric and character formats, the data set must contain the variables FMTNAME, START, and LABEL, which are described in Output Control Data Set. The remaining variables are not always required.
  • If you are creating a character format or informat, then you must either begin the format or informat name with a dollar sign ($) or specify a TYPE variable with the value C.
  • If you are creating a PICTURE statement format, then you must specify a TYPE variable with the value P.
  • If you are creating a format with ranges of input values, then you must specify the END variable. If range values are to be noninclusive, then the variables SEXCL and EEXCL must each have a value of Y. Inclusion is the default.
You can create more than one format from an input control data set if the observations for each format are grouped together.
You can use a VALUE, INVALUE, or PICTURE statement in the same PROC FORMAT step with the CNTLIN= option. If the VALUE, INVALUE, or PICTURE statement is creating the same informat or format that the CNTLIN= option is creating, then the VALUE, INVALUE, or PICTURE statement creates the informat or format and the CNTLIN= data set is not used. You can, however, create an informat or format with VALUE, INVALUE, or PICTURE and create a different informat or format with CNTLIN= in the same PROC FORMAT step.
For an example featuring an input control data set, see Creating a Format from a Data Set.

Procedure Output

The FORMAT procedure prints output only when you specify the FMTLIB option or the PAGE option in the PROC FORMAT statement. The printed output is a table for each format or informat entry in the catalog that is specified in the LIBRARY= option. The output also contains global information and the specifics of each value or range that is defined for the format or informat. You can use the SELECT or EXCLUDE statement to control which formats and informats are represented in the FMTLIB output. For details, see SELECT Statement and EXCLUDE Statement. For an example, see Printing the Description of Informats and Formats.
The FMTLIB output shown in the following output contains a description of the $CITY. format, which is created in Creating a Format for Character Values, and the EVALUATION. informat, which is created in Converting Raw Character Data to Numeric Values.
Output from PROC FORMAT with the FMTLIB Option
Output from PROC FORMAT with the FMTLIB Option
The fields are described below in the order in which they appear in the output, from left to right:
INFORMAT NAME or FORMAT NAME
the name of the informat or format. Informat names begin with an at-sign (@).
LENGTH
the length of the informat or format. PROC FORMAT determines the length in the following ways:
  • For character informats, the value for LENGTH is the length of the longest raw data value on the left side of the equal sign.
  • For numeric informats, the following is true:
    • LENGTH is 12 if all values on the left side of the equal sign are numeric.
    • LENGTH is the same as the longest raw data value on the left side of the equal sign.
  • For formats, the value for LENGTH is the length of the longest value on the right side of the equal sign.
In the output for $CITY., the LENGTH is 14 because the longest picture is 14 characters.
In the output for @EVALUATION., the length is 1 because 1 is the longest raw data value on the left side of the equal sign.
NUMBER OF VALUES
the number of values or ranges associated with the informat or format. NOZEROS. has 4 ranges, and EVAL. has 5.
MIN LENGTH
the minimum length of the informat or format. The value for MIN LENGTH is 1 unless you specify a different minimum length with the MIN= option.
MAX LENGTH
the maximum length of the informat or format. The value for MAX LENGTH is 40 unless you specify a different maximum length with the MAX= option.
DEFAULT LENGTH
the length of the longest value in the INVALUE or LABEL field, or the value of the DEFAULT= option.
FUZZ
the fuzz factor. For informats, FUZZ always is 0. For formats, the value for this field is STD if you do not use the FUZZ= option. STD signifies the default fuzz value.
START
the beginning value of a range. FMTLIB prints only the first 16 characters of a value in the START and END columns.
END
the ending value of a range. The exclusion sign (<) appears after the values in START and END, if the value is excluded from the range.
INVALUE
appears only for informats and contains the values that have informats.
LABEL
LABEL appears only for formats and contains either the formatted value or picture. The SAS version number and the date on which the format or informat was created are in parentheses after INVALUE or LABEL.
Note: If SAS displays version numbers V7|V8, then the format is compatible with those versions. If it is not compatible with those earlier releases, the release that created the format is shown. Version V9 supports long format and informat names (over eight characters), and V7|V8 do not.
For picture formats, such as NOZEROS., the LABEL section contains the PREFIX=, FILL=, and MULT= values. To note these values, FMTLIB prints the letters P, F, and M to represent each option, followed by the value. For example, in the LABEL section, P-. indicates that the prefix value is a hyphen followed by a period.
FMTLIB prints only 40 characters in the LABEL column.