Chapter Contents


The FORMAT Procedure

INVALUE Statement

Creates an informat for reading and converting raw data values.

Featured in: Converting Raw Character Data to Numeric Values .
See also: The section on informats in SAS Language Reference: Dictionary for documentation on informats supplied by SAS.

INVALUE <$>name <(informat-option(s))>

To do this Use this option
Specify the default length of the informat DEFAULT=
Specify a fuzz factor for matching values to a range FUZZ=
Specify a maximum length for the informat MAX=
Specify a minimum length for the informat MIN=
Store values or ranges in the order that you define them NOTSORTED
Left-justify all input strings before they are compared to ranges JUST
Uppercase all input strings before they are compared to ranges UPCASE

Required Arguments

names the informat you are creating. The name must be a SAS name up to seven characters long, not ending in a number. If you are creating a character informat, use a dollar sign ($) as the first character, with no more than six additional characters. A user-defined informat name cannot be the same as an informat that is supplied by SAS. Refer to the informat later by using the name followed by a period. However, do not put a period after the informat name in the INVALUE statement.
Tip: When SAS prints messages referring to a user-written informat, the name is prefixed by an at sign (@). When the informat is stored, the at sign is prefixed to the name you specify for the informat, which is why you are limited to only seven characters in the name. You need to use the at sign only when you are using the name in an EXCLUDE or SELECT statement; do not prefix the name with an at sign when you are associating the informat with a variable.

The following options are common to the INVALUE, PICTURE, and VALUE statements and are described in Informat and Format Options :
FUZZ= fuzz-factor

In addition, you can use the following options:

left-justifies all input strings before they are compared to the ranges.

converts all raw data values to uppercase before they are compared to the possible ranges. If you use UPCASE, make sure the values or ranges you specify are in uppercase.

specifies raw data and values that the raw data will become. The value-range-set(s) can be one or more of the following:
value-or-range-1 <..., value-or-range-n>=informatted-value|[existing-informat]

The informat converts the raw data to the values of informatted-value on the right side of the equal sign.

is the value you want the raw data in value-or-range to become. Use one of the following forms for informatted-value:

is a character string up to 200 characters long. Typically, character-string becomes the value of a character variable when you use the informat to convert raw data. Use character-string for informatted-value only when you are creating a character informat. If you omit the single quotation marks around character-string, the INVALUE statement assumes the quotation marks are there.

For hex literals, you can use up to 199 typed characters, or up to 98 represented characters at 2 hex characters per represented character.

is a number that becomes the informatted value. Typically, number becomes the value of a numeric variable when you use the informat to convert raw data. Use number for informatted-value when you are creating a numeric informat. The maximum for number depends on the host operating environment.

treats data values in the designated range as invalid data. SAS assigns a missing value to the variable, prints the data line in the SAS log, and issues a warning message.

prevents the informat from converting the raw data as any other value. For example, the following GROUP. informat converts values 01 through 20 and assigns the numbers 1 through 20 as the result. All other values are assigned a missing value.
   invalue group 01-20= _same_
                 other= .;

is an informat that is supplied by SAS or a user-defined informat. The informat you are creating uses the existing informat to convert the raw data that match value-or-range on the left side of the equals sign. If you use an existing informat, enclose the informat name in square brackets, for example, [date9.] or with parentheses and vertical bars, for example, (|date9.|). Do not enclose the name of the existing informat in single quotation marks.

See Specifying Values or Ranges .

Consider the following examples:

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.