Previous Page | Next Page

The FSEDIT Procedure

FORMAT Statement


Associates formats with variables in the input data set. Formats are patterns that the SAS System uses to determine how variable values are displayed. The formats can be either SAS formats or custom formats that you have defined with the FORMAT procedure.
Reminder: FORMAT statements are ignored if you use them in conjunction with a PROC FSEDIT statement that includes the NEW= option.

FORMAT variable-list format <... variable-list-n format-n>;

Arguments

At least one pair of the following arguments is required:

variable-list

consists of one or more variable names from the input data set.

format

is the SAS format or user-defined format to associate with the specified variable or variables.


Using the FORMAT Statement

You can use a single FORMAT statement to assign the same format to several variables or to assign different formats to different variables. You can use any number of FORMAT statements with each PROC FSEDIT statement.

Formats that are specified in a FORMAT statement take precedence over formats that are defined in the data set itself. Formats that are assigned in a FORMAT statement remain in effect only for the duration of the procedure. The FORMAT statement does not affect any format assignments that are stored in the data set.

If you are creating a new application, or if you do not use a custom FSEDIT display, then the format widths that you specify may affect the widths of the fields for the associated variables in the FSEDIT window. If you are using an existing application, the assigned formats determine how variable values are displayed, but they do not affect field widths in the FSVIEW window.

Be aware that the format you assign to a variable affects the informats you can assign with the INFORMAT statement. For example, suppose the data set that is displayed by the FSVIEW procedure contains a variable AMOUNT that is assigned the format DOLLAR10.2 but an informat of 10.2. Because of the format, values in the column for the variable AMOUNT are displayed with commas and a leading dollar sign, so the value 1250 would be displayed as $1,250.00. However, if you edit this value (for example, changing it to $1,150.00) and press ENTER, an error condition occurs. The 10.2 informat does not allow the dollar sign ($) or comma characters in entered values. An appropriate informat for this variable is COMMA., which does allow these characters.

Refer to SAS Language Reference: Dictionary for more detailed information about formats and on the FORMAT statement. See the description of the FORMAT procedure in Base SAS Procedures Guide for information about defining your own formats.

Previous Page | Next Page | Top of Page