Date: Thu, 23 Aug 2007 08:09:20 -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: DISTINGUISH INTEGER AND DECIMAL
could someone please tell me, what that should bring! Are we talking about
characters or integers (I understand something numeric by INTEGER!).
You might understand it or not: there is nothing like INTEGER in SAS! The
only numeric type in SAS is FLOAT BINARY.
Representating something like an integer requires something like BCD (Binary
Coded Decimal) where each number is coded. You have a half-byte for each
digit, so you can represent something like 11 (that should be an integer)
with 1 Byte (not really, because you might need also negative values, so
another half-byte for the sign.
In float binary that is always internal something like 1.1 * 10e1. If you
are converting a num to char, it is only a question with which format you do
that. The default might be best8. or something like that. Use 8.2 and you'll
find your dot.
Again: it's seseless to ask for type INTEGER in SAS if there is none!
Gerhard
On Thu, 23 Aug 2007 05:23:33 -0400, Arild S <sko@KLP.NO> wrote:
>On Thu, 23 Aug 2007 09:00:50 -0000, cat.. <cat.b41@GMAIL.COM> wrote:
>
>>On Aug 22, 2:55 pm, gerhard.hellrie...@T-ONLINE.DE (Gerhard
>>Hellriegel) wrote:
>>> I don't understand that: in SAS there is only one type of numeric
>variable =
>>> "float binary" to say it in PL1 syntax. There are no integers in SAS. So
>>> searching a dot in the values makes no sense.
>>
>>It does, run this:
>>
>>data _null_;
>> format x 8.1;
>> x = 3;
>> y = index(x,'.');
>> put y =;
>>run;
>>
>>Regards,
>>
>>Catherine
>
>
>No, it doesn't. INDEX is a character function. It applies to character
>variables, not numeric ones. That's why you get the message
>
>NOTE: Numeric values have been converted to character values...
>
>SAS converts your numeric 3 to character "3", and searches for a '.'.
>The value returned is 0, as a dot is not found. Try a search for "3":
>
>13 data _null_;
>14 format x 8.1;
>15 x = 3;
>16 y = index(left(x),'3');
>17 put y =;
>18 run;
>
>
>you get the expected..
>
>NOTE: Numeric values have been converted to character values ...
>
>and, surprise
>
>y=1
|