Date: Mon, 15 Mar 2010 14:03:47 -0400
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: what is the main purpose of informat?
for me there are 2 important locations for conversion from char to numeric.
One is the INPUT statement for reading raw data.
The other is the INPUT function, which is the main function for numeric
conversion:
num_data = INPUT(char_data, informat.);
I use that more often than INPUT statement.
Sometimes you can also use the SAS automatic conversion by simply
assigning a char-variable to a numeric one, but that is only possible
for "standard"-numerics, not for date-values, datetime-values, or other
special values.
For example:
that 01-01-2010 should be a date, you must tell SAS by assigning an
INFORMAT like DDMMYY10.
Gerhard
On Mon, 15 Mar 2010 13:42:27 -0400, Jonas Bilenas
<jonas.bilenas@CHASE.COM> wrote:
>An INFORMAT is used to read in data into a SAS dataset. A SAS FORMAT is
>used to write out data. There are many built in SAS INFORMATS and FORMATS
>and they both work with numeric or character data.
>
>You can also build your own FORMATS and INFORMATS using PROC FORMAT. As
an
>example of using a numeric INFORMAT, let's assume we have a flat file with
>a 3 digit integer field. Missing values are coded up as 999, but you want
>to represent those value as missing when reading into SAS. Here is how
you
>can code up:
>
>PROC FORMAT;
> INVALUE miss999x low - 998 = [3.]
> 999 = .
> ;
>RUN;
>
>DATA TEST;
> INFILE flat_file;
> INPUT @1 X miss999x.;
>RUN;
>
>You can modify the above if you have more than 1 missing code since you
can
>code up to 27 different missing values.
>
>
>Jonas Bilenas
>
>
>
>
>
>On Sat, 13 Mar 2010 05:05:12 -0800, Patrick <patrick.matter@GMX.CH> wrote:
>
>>As Tom said: The main purpose is to convert character to numeric,
|