Creates an informat for
reading and converting raw data values.
INVALUE <$>name
<(informat-option(s))>
<value-range-set(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 |
- name
- 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:
| DEFAULT=length |
| FUZZ= fuzz-factor |
| MAX=length |
| MIN=length |
| NOTSORTED |
In addition, you can use the
following options:
- JUST
- left-justifies all input strings before they are compared
to the ranges.
- UPCASE
- 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.
- value-range-set(s)
- 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.
- informatted-value
- is the value you want the raw data in value-or-range to become. Use one of the following forms for informatted-value:
- 'character-string'
- 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.
- number
- 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.
- _ERROR_
- 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.
- _SAME_
- 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= .;
- existing-informat
- 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.
- value-or-range
- See Specifying Values or Ranges.
Consider the
following examples:
- The $GENDER. character informat converts the raw data values
F and M to
1 and 2:
invalue $gender 'F'='1'
'M'='2';
The dollar sign prefix indicates that the informat converts character
data.
- When you are creating numeric informats, you can specify character
strings or numbers for value-or-range. For example, the TRIAL.
informat converts any character string that sorts between
A and M to the number 1 and
any character string that sorts between N and Z to the number 2. The informat treats the unquoted range
1-3000 as a numeric range, which includes all numeric values between
1 and 3000:
invalue trial 'A'-'M'=1
'N'-'Z'=2
1-3000=3;
If you use a numeric informat to convert character strings that do not
correspond to any values or ranges, you receive an error message.
- The CHECK. informat uses _ERROR_ and _SAME_ to convert values
of 1 through 4 and 99. All other values are invalid:
invalue check 1-4=_same_
99=.
other=_error_;
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.