|
The five categories (character, numeric, column binary, date-time, user defined) are not mutually exclusive. In
terms of data type, there are only two: character and numeric.
Informats operate on strings, either character expressions or fields in file buffers. So the first argument to
INPUTN (or to INPUTC or to INPUT) must be of character type. Hence the conversion messages in the log.
I think the phrase "numeric data values" is intended to make the point that the strings must be *interpretable* as
numbers, such as
1
1.2
-1.2E3
I would make ANEM3_ a format rather than an informat
value anem3_
0-<4.4='2'
4.4-<8.9='1'
8.9-High='0'
;
Then wrap the INPUT function around the PUTN function to get a numeric result:
leucocat=input(putn(wbc,leucofmt),1.);
On Thu, 22 Aug 2002 11:33:33 -0400, Delaney, Kevin P. <khd8@CDC.GOV> wrote:
>What exactly does "Numeric Informat" mean??
>
>According to the SAS Language Reference: Concepts
>
>http://oz.uc.edu/doc/sasdoc/sashtml/lrcon/z0920449.htm
><http://oz.uc.edu/doc/sasdoc/sashtml/lrcon/z0920449.htm>
>
>there are 5 categories of Informats, the last 2 being:
>
>NUMERIC instructs SAS to read numeric data values into numeric variables.
>
>USER-DEFINED instructs SAS to read data values by using an informat that
>is created with an INVALUE statement in PROC FORMAT.
>
>
>Proc format can create both Numeric and Character informats using the
>Invalue statement, which you would think would behave as described in the
>table referenced above, that is, a Numeric informat created by Proc Format
>should "read numeric data values into numeric variables," right??
>
>So I am creating Numeric informat's, for example:
>
>invalue anem3_
>
> .=.
> 0-<4.4=2
> 4.4-<8.9=1
> 8.9-High=0
> ;
>
>And then using them with InputN, for example:
>
>data cbc3(drop=leucofmt);
>SET cbc2;
><other similar statements>
>
>leucofmt=put(agedays,ageleuco.);
>leucocat=inputn(wbc,leucofmt);
>
>format leucocat leucoill.;
>run;
>
>And I get the message in my log that "NOTE: Numeric values have been
>converted to character values at the places given by: " at WBC the Numeric
>value that is the first argument to INPUTN. So SAS doesn't like using the
>Numeric source with a Numeric informat to make a new Numeric variable, it
>appears to want a Character SOURCE to use with the NUMERIC informat???
>
>Am I missing something here??
>
>Seeking clarification on how informats and formats work,
>
>Kevin Delaney
>KDelaney@cdc.gov
|