The 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. Additionally, 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:
specifies a numeric variable that indicates the default length for format or informat.
specifies a character variable that gives the range's ending value.
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. |
for picture formats, specifies a numeric variable whose value is the value of the FILL= option.
specifies a character variable whose value is the format or informat name.
specifies a numeric variable whose value is the value of the FUZZ= option.
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. |
specifies a character variable whose value is associated with a format or an informat.
specifies a numeric variable whose value is the value of the LENGTH= option.
specifies a numeric variable whose value is the value of the MAX= option.
specifies a numeric variable whose value is the value of the MIN= option.
specifies a numeric variable whose value is the value of the MULT= option.
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. |
for picture formats, specifies a character variable whose value is the value of the PREFIX= option.
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. |
specifies a character variable that gives the range's starting value.
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 Examples: FORMAT Procedure.
Output Control Data Set for PROC FORMAT Examples
An Output Control Data Set 1 D L F D D A A M E L P N D I T N T S L F E R O S E E G A G N T A A N F E M F E T E E C 3 T U O A A E B M M U G U F U I D Y X X H S S Y A b M R N E I A L T Z I L L I P C C L E E P G s E T D L N X T H Z X T L T E L L O P P E E 1 BENEFIT LOW 7304 WORDDATE20. 1 40 20 20 1E-12 0.00 0 N N N LF 2 BENEFIT 7305 HIGH ** Not Eligible ** 1 40 20 20 1E-12 0.00 0 N N N H 3 NOZEROS LOW -1 00.00 1 40 5 5 1E-12 - 100.00 0 P N N L . , 4 NOZEROS -1 0 99 1 40 5 5 1E-12 -. 100.00 0 P Y Y . , 5 NOZEROS 0 1 99 1 40 5 5 1E-12 . 100.00 0 P N Y . , 6 NOZEROS 1 HIGH 00.00 1 40 5 5 1E-12 100.00 0 P N N H . , 7 PTSFRMT 0 3 0% 1 40 3 3 1E-12 0.00 0 N N N 8 PTSFRMT 4 6 3% 1 40 3 3 1E-12 0.00 0 N N N 9 PTSFRMT 7 8 6% 1 40 3 3 1E-12 0.00 0 N N N 10 PTSFRMT 9 10 8% 1 40 3 3 1E-12 0.00 0 N N N 11 PTSFRMT 11 HIGH 10% 1 40 3 3 1E-12 0.00 0 N N N H 12 USCURR LOW HIGH 000,000 1 40 7 7 1E-12 $ 1.61 0 P N N LH . , 13 CITY BR1 BR1 Birmingham UK 1 40 14 14 0 0.00 0 C N N 14 CITY BR2 BR2 Plymouth UK 1 40 14 14 0 0.00 0 C N N 15 CITY BR3 BR3 York UK 1 40 14 14 0 0.00 0 C N N 16 CITY US1 US1 Denver USA 1 40 14 14 0 0.00 0 C N N 17 CITY US2 US2 Miami USA 1 40 14 14 0 0.00 0 C N N 18 CITY **OTHER** **OTHER** INCORRECT CODE 1 40 14 14 0 0.00 0 C N N O 19 EVAL C C 1 1 40 1 1 0 0.00 0 I N N 20 EVAL E E 2 1 40 1 1 0 0.00 0 I N N 21 EVAL N N 0 1 40 1 1 0 0.00 0 I N N 22 EVAL O O 4 1 40 1 1 0 0.00 0 I N N 23 EVAL S S 3 1 40 1 1 0 0.00 0 I N N
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 NOZEROS. format, which is created in Building a Picture Format: Step by Step, and the EVAL. informat, which is created in Converting Raw Character Data to Numeric Values.
Output from PROC FORMAT with the FMTLIB Option
FMTLIB Output for the NOZEROS. Format and the 1 EVAL. Informat ---------------------------------------------------------------------------- | FORMAT NAME: NOZEROS LENGTH: 5 NUMBER OF VALUES: 4 | | MIN LENGTH: 1 MAX LENGTH: 40 DEFAULT LENGTH 5 FUZZ: STD | |--------------------------------------------------------------------------| |START |END |LABEL (VER. 7.00 29MAY98:10:00:24) | |----------------+----------------+----------------------------------------| |LOW | -1|00.00 P- F M100 | | -1< 0<99 P-. F M100 | | 0| 1<99 P. F M100 | | 1|HIGH |00.00 P F M100 | ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- | INFORMAT NAME: @EVAL LENGTH: 1 NUMBER OF VALUES: 5 | | MIN LENGTH: 1 MAX LENGTH: 40 DEFAULT LENGTH 1 FUZZ: 0 | |--------------------------------------------------------------------------| |START |END |INVALUE(VER. 7.00 29MAY98:10:00:25) | |----------------+----------------+----------------------------------------| |C |C | 1| |E |E | 2| |N |N | 0| |O |O | 4| |S |S | 3| ----------------------------------------------------------------------------The fields are described below in the order they appear in the output, from left to right:
the name of the informat or format. Informat names begin with an at-sign (@).
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
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 @EVAL., the length is 1 because 1 is the length of the longest raw data value on the left side of the equal sign.
In the output for NOZEROS., the LENGTH is 5 because the longest picture is 5 characters.
the number of values or ranges associated with the informat or format. NOZEROS. has 4 ranges, EVAL. has 5.
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.
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.
the length of the longest value in the INVALUE or LABEL field, or the value of the DEFAULT= option.
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.
the beginning value of a range. FMTLIB prints only the first 16 characters of a value in the START and END columns.
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.
appears only for informats and contains the values that have informats.
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 dash followed by a period.
FMTLIB prints only 40 characters in the LABEL column.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.