You are on page 1of 3

Enhance Report With SAS Format

Usage of Format:
Syntax
Format variablename formatname;
Association of Format:
In Proc Step, association of format to data is temporary
In Data Step, association of format to data is temporary
Create User-Defined Format
Use Pros Format to create the user-defined format:
Syntax
PROC FORMAT LIBRARY = XXXX<options>;
VALUE formatname value = LABEL;
RUN;
Format name can not be more than 32 characters
Format name can not end with a number
Label can not be more than 200 characters
Create User-Defined Format
Format Types:
Character format
begins with dollar sign $, used for character variable
Numeric format
Used for numeric variable

When defining format, VALUE can be:
A single value, like 1 or A
A range of numeric value, like 1-100
A range of character value, like A Z
A list of values separated by comma
When defining format,
-Avoid gap and overlapping
-Use less than (<) symbol to avoid overlapping of value
-Use LOW to indicate lower limit of a range, it does not include missing value
-Use HIGH to define upper limit of range
-Use OTHER to define missing values as well as any values that are not specifically
defined in a range
Temporary Format Vs. Permanent Format
When using PROC FORMAT:
If no library specified, then temporary format are created
Temporary format only exists in current SAS session
Use library to create permanent format
Usage Of User-Defined Format
Need to put a dot(.) at the end to indicate the user-defined format
By default, temporary format is used
Use options FMTSEARCH to access permanent format

You might also like