Date: Sun, 28 Apr 1996 00:23:00 -0600
Reply-To: Andrew James Llwellyn Cary <ajlcary@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Andrew James Llwellyn Cary <ajlcary@IX.NETCOM.COM>
Organization: Cary Consulting Services
Subject: Re: Integers less than 8 bytes?
> I have several large data sets that could be dramatically reduced in size
> if only I could use integers that only take one or two bytes in the data
> What kind of performance penalty do I pay if I try to work around this by
> doing something like...
> proc format;
> value ShortInt (fuzz=0)
> 0 = 0;
> 1 = 1;
> 2 = 2;
> 99 = 99;
> ShortInt variable should ideally now only take up a single byte in the
> data set - but at what price as far as speed goes?
> Frustratedly yours,
All numeric values in SAS are 8-byte floating point values. SAS allows
'special' shorter floating values by using the LENGTH command. Lengths
may be specified down to 2 or 3 bytes (depends on the platform) for
numeric variables. There is a corresponding loss of precision.
In the example above, you have recoded a 8 byte real into an 8 byte
character string unless you specify character string lengths in a length
statement. Formats by themselves merely convert numeric and character
variables into character variables. The default character string length
is 8 bytes. If you do convert the values into character strings you will
have to convert them back into numeric variables to perform operations
Andrew J. L. Cary | I Reckon that the Opinions
Senior Curmudgeon | expressed here DO represent
Cary Consulting Services, Newark, CA | those of the management of
firstname.lastname@example.org | Cary Consulting Services