SAS Formats
Formats in SAS can be thought of as functions that transform our data values from the form in which they are stored in a SAS data set into some more readily understood or useful form.
Formats have many uses, including
- Controlling the display of significant digits, commas, and currency symbols
- Adding value labels to categorical (and continuous!) data
- Displaying date and time data in common, easily understood units
- Recoding data
SAS also has a reciprocal concept (language element) called the informat that is used for converting values into data values to be stored in a SAS data set. This is most often used when importing text data into SAS.
SAS provides numerous built-in formats and also a PROC FORMAT for you to define your own formats. Formats may be used with both continuous and categorical data, and there are both numeric and character formats.
Formats may be assigned to a variable in a DATA step, in which case they are used in all subsequent processing. Formats may also be assigned in PROC steps, in which case they are used for just that PROC.
There are also several DATA step functions and statements that make use of formats.