Chapter Contents

Previous

Next
SAS Companion for the OpenVMS Operating Environment

Numeric Variables in the VAX Environment

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 OpenVMS VAX, the VAX data type of numeric values is D_FLOATING. The precision of this type of floating-point value is 16 decimal digits. For more information about the representation of the D_FLOATING VAX data type, refer to Architecture Reference Manual for VAX.

Significant Digits and Largest Integer by Length for SAS Variables in the VAX Environment specifies the significant digits and largest integers that can be stored in SAS numeric variables.

Significant Digits and Largest Integer by Length for SAS Variables in the VAX Environment
Length
in Bytes
Significant
Digits
Retained
Largest Integer
Represented
Exactly
2 2 256
3 4 65,536
4 7 16,777,316
5 9 4,294,967,296
6 12 1,099,511,627,776
7 14 281,474,946,710,656
8 16 72,057,594,037,927,936

For example, if you know that the values of a numeric variable are between 0 and 100, you can use a length of 2 bytes to store the number. This saves space in your data set. The following is an example:

data mydata;
   length num 2;
   input num;
run;

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

CAUTION:
Only use the 2-byte limit for variables whose values are small, preferably integers. If the value of a variable becomes large or has many significant digits, you may lose precision during arithmetic calculations if the length is only 2 bytes.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

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