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?
stow@skyfox.usask.ca wrote:
>
> 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
sets.
>
> 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;
> etc
> 99 = 99;
> run;
>
> 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,
>
> Rob
First
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.
Second
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
on them.
--
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
ajlcary@ix.netcom.com | Cary Consulting Services