FORMAT Procedure

Specifying Values or Ranges

As the syntax of the INVALUE, PICTURE, and VALUE statements indicates, you must specify values as value-range-sets. On the left side of the equal sign, you specify the values that you want to convert to other values. On the right side of the equal sign, you specify the values that you want the values on the left side to become. This section discusses the different forms that you can use for value-or-range, which represents the values on the left side of the equal sign. For details about how to specify values for the right side of the equal sign, see the “Required Arguments” section for the appropriate statement.
The INVALUE, PICTURE, and VALUE statements accept numeric values on the left side of the equal sign. In character informats, numeric ranges are treated as character strings. INVALUE and VALUE also accept character strings on the left side of the equal sign.
As the syntax shows, you can have multiple occurrences of value-or-range in each value-range-set, with commas separating the occurrences. Each occurrence of value-or-range is either one of the following:
value
a single value, such as 12 or 'CA'. For character formats and informats, enclose the character values in single quotation marks. If you omit the quotation marks around value, then PROC FORMAT assumes the quotation marks to be there.
You can use the keyword OTHER= as a single value. OTHER matches all values that do not match any other value or range. You cannot nest a user-defined format by using the format as the value of OTHER=, unless the format is a function that formats values. For more information, see Using a Function to Format Values. For examples, see Creating a Format for Character Values and Creating a Function to Use as a Format.
range
a list of values (for example, 12–68 or 'A'-'Z'). For ranges with character strings, be sure to enclose each string in single quotation marks. For example, if you want a range that includes character strings from A to Z, then specify the range as 'A'-'Z', with single quotation marks around the A and around the Z.
If you specify 'A-Z', then the procedure interprets it as a three-character string with A as the first character, a hyphen (-) as the second character, and a Z as the third character.
If you omit the quotation marks, then the procedure assumes quotation marks around each string. For example, if you specify the range abc-zzz, then the procedure interprets it as 'abc'-'zzz'.
In numeric user-defined informats, the procedure interprets an unquoted numeric range on the left side of a value-range-set as a numeric range. In a character user-defined informat, the procedure interprets an unquoted numeric range on the left side of a value-range-set as a character string. For example, in a character informat, the range 12–86 is interpreted as '12'–'86'.
You can use LOW or HIGH as one value in a range, and you can use the range LOW-HIGH to encompass all values. For example, the following are valid ranges:
low-'ZZ' 
35-high
low-high
You can use the less than (<) symbol to exclude values from ranges. If you are excluding the first value in a range, then put the < after the value. If you are excluding the last value in a range, then put the < before the value. For example, the following range does not include 0:
0<-100
Likewise, the following range does not include 100:
0-<100
If a value at the high end of one range also appears at the low end of another range, and you do not use the < noninclusion notation, then PROC FORMAT assigns the value to the first range. For example, in the following ranges, the value AJ is part of the first range:
'AA'-'AJ'=1 'AJ'-'AZ'=2
In this example, to include the value AJ in the second range, use the noninclusive notation on the first range:
'AA'-<'AJ'=1 'AJ'-'AZ'=2
If you overlap values in ranges, then PROC FORMAT returns an error message unless, for the VALUE statement, the MULTILABEL option is specified. For example, the following ranges will cause an error: 'AA'-'AK'=1 'AJ'-'AZ=2.
Each value-or-range can be up to 32,767 characters. If value-or-range has more than 32,767 characters, then the procedure truncates the value after it processes the first 32,767 characters.
Note: You do not have to account for every value on the left side of the equal sign. Those values are converted using the default informat or format. For example, the following VALUE statement creates the TEMP. format, which prints all occurrences of 98.6 as NORMAL:
value temp 98.6='NORMAL';
If the value were 96.9, then the printed result would be 96.9.