Chapter Contents |
Previous |
Next |
The FORMAT Procedure |
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))>
<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 |
Required Arguments |
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. |
Options |
DEFAULT=length | |
FUZZ= fuzz-factor | |
MAX=length | |
MIN=length | |
NOTSORTED |
In addition, you can use the following options:
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.
For hex literals, you can use up to 199 typed characters, or up to 98 represented characters at 2 hex characters per represented character.
invalue group 01-20= _same_ other= .;
Consider the following examples:
F
and M
to
1
and 2
:
invalue $gender 'F'='1' 'M'='2';
The dollar sign prefix indicates that the informat converts character data.
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.
invalue check 1-4=_same_ 99=. other=_error_;
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.