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. 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

DEFAULT

  • a numeric variable that indicates the default length for format or informat

END

  • a character variable that gives the range s ending value

EEXCL

  • a character variable that indicates whether the range s ending value is excluded. Values are

    Y

    the range s ending value is excluded

    N

    the range s ending value is not excluded

FILL

  • for picture formats, a numeric variable whose value is the value of the FILL= option

FMTNAME

  • a character variable whose value is the format or informat name

FUZZ

  • a numeric variable whose value is the value of the FUZZ= option

HLO

  • a character variable that contains range information about the format or informat in the form of eight different letters that can appear in any combination. Values are

    F

    standard SAS format or informat used for formatted value or informatted value

    H

    range s ending value is HIGH

    I

    numeric informat range (informat defined with unquoted numeric range)

    L

    range s starting value is LOW

    N

    format or informat has no ranges, including no OTHER= range

    O

    range is OTHER

    M

    MULTILABEL option is in effect

    R

    ROUND option is in effect

    S

    NOTSORTED option is in effect

LABEL

  • a character variable whose value is the informatted or formatted value or the name of an existing informat or format

LENGTH

  • a numeric variable whose value is the value of the LENGTH= option

MAX

  • a numeric variable whose value is the value of the MAX= option

MIN

  • a numeric variable whose value is the value of the MIN= option

MULT

  • a numeric variable whose value is the value of the MULT= option

NOEDIT

  • for picture formats, a numeric variable whose value indicates whether the NOEDIT option is in effect. Values are

    1

    NOEDIT option is in effect

    NOEDIT option is not in effect

PREFIX

  • for picture formats, a character variable whose value is the value of the PREFIX= option

SEXCL

  • a character variable that indicates whether the range s starting value is excluded. Values are

    Y

    the range s starting value is excluded

    N

    the range s starting value is not excluded

START

  • a character variable that gives the range s starting value

TYPE

  • a character variable that indicates the type of format. Possible values are

    C

    character format

    I

    numeric informat

    J

    character informat

    N

    numeric format (excluding pictures)

    P

    picture format

Output 23.1 shows an output control data set that contains information on all the informats and formats created in Examples: FORMAT Procedure on page 463.

Output 23.1: Output Control Data Set for PROC FORMAT Examples
start example
 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 
end example
 

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 on page 447 and EXCLUDE Statement on page 434.

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 on page 458. 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 Example 5 on page 472.

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 on page 447 and EXCLUDE Statement on page 434. For an example, see Example 6 on page 476.

The FMTLIB output shown in Output 23.2 contains a description of the NOZEROS. format, which is created in Building a Picture Format: Step by Step on page 443, and the EVAL. informat, which is created in Example 4 on page 470.

Output 23.2: Output from PROC FORMAT with the FMTLIB Option
start example
 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                           -100.00               P-  F  M100                         -1<               0<99                  P-. F  M100                          0               1<99                  P.  F  M100                          1HIGH            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  ---------------------------------------------------------------------------- 
end example
 

The fields are described below in the order they appear in the output, from left to right:

INFORMAT NAME

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 equals sign.

    • For numeric informats

      • LENGTH is 12 if all values on the left side of the equals 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 equals sign.

    In the output for NOZEROS., the LENGTH is 5 because the longest picture is 5 characters .

NUMBER OF VALUES

  • the number of values or ranges associated with the informat or format. NOZEROS. has 4 ranges, 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

LABEL

  • INVALUE appears only for informats and contains the informatted values. LABEL appears only for formats and contains either the formatted value or picture. The SAS release number and the date on which the format or informat was created are in parentheses after INVALUE or LABEL.

    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.




Base SAS 9.1.3 Procedures Guide (Vol. 1)
Base SAS 9.1 Procedures Guide, Volumes 1, 2, 3 and 4
ISBN: 1590472047
EAN: 2147483647
Year: 2004
Pages: 260

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net