Chapter Contents

Previous

Next
SAS Companion for the OS/2 Environment

Numeric Variables

The default length of numeric variables in SAS data sets is 8 bytes. (You can control the length of SAS numeric variables with the LENGTH statement in the DATA step.) In the SAS System under OS/2, the OS/2 data type of numeric values that have a length of 8 is LONG REAL. The precision of this type of floating-point values is 16 decimal digits. For more information about the representation of the LONG REAL OS/2 data type, see Intel Corporation's i486 Microprocessor Programmer's Reference Manual. Significant Digits and Largest Integer by Length for SAS Variables under OS/2 specifies the significant digits and largest integer values that can be stored in SAS numeric variables.

Significant Digits and Largest Integer by Length for SAS Variables under OS/2
Length
in Bytes
Largest Integer
Represented Exactly
Exponential
Notation
3 8,192 213
4 2,097,152 221
5 536,870,912 229
6 137,438,953,472 237
7 35,184,372,088,832 245
8 9,007,199,254,740,992 253

Suppose you know that a numeric variable always has values between 0 and 100, you can use a length of 3 to store the number and thus save space in your data set. The following is an example:

data mydata;
   length num 3;
   more data lines
run;

Note:   Dummy variables (those whose only purpose is to hold 0 or 1) can be stored in a variable whose length is 3 bytes.  [cautionend]

CAUTION:
Use the 3-byte limit for only those variables whose values are small, preferably integers. If the value of a variable becomes large or has many significant digits, you may lose precision when saving the results of arithmetic calculations if the length of a variable is less than 8 bytes.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.