The programmer can create or define formats to provide a more meaningful description to the values of a variable.

Formats can be either temporary (e.g., they only exist within the program) or permanent (e.g., they are saved as a file on the server or computer). Formats for a character variable always start with $, while numeric formats can start with any letter.

Creating A Format Using PROC FORMAT with Value Statements:

Syntax

PROC Format Syntax

Example:

PROC Format Example

A simple data check is looking at formatted frequencies to see how much data are missing and non-missing. The following will simply show the number of missing and non-missing values for all variables in the dataset. The character variables will use the $charf format, while the numeric variables will use the numf format.

PROC Format Example

Creating A Format from A File:

Sometimes there are just too many values to list out individually in a PROC FORMAT VALUE statement. In these cases, it is possible to create a format using a dataset. The following example shows how it may be done.

Example:

In this example, we are assigning thousands of procedure codes into groups. The researcher has given the programmer his group definitions for specific CPT codes in a file called procedures.txt. Tabs were used to separate the code from the group.

PROC Format Value Statement