Chapter Contents |
Previous |
Next |

SAS Companion for UNIX Environments |

The issue of numeric precision affects the return values of almost all SAS System math functions and many numeric values returned from SAS System procedures. Numeric values in the SAS System for UNIX are represented as IEEE double-precision floating-point numbers. The decimal precision of a full 8-byte number is approximately 16 decimal digits.

Significant Digits and Largest Integer by Length for SAS Variables under UNIX specifies the significant digits and largest integer that can be stored exactly in SAS numeric variables.

Length in Bytes |
Largest IntergerRepresented Exactly |
ExponentialNotation |
---|---|---|

3 | 8,192 | 2^{13} |

4 | 2,097,152 | 2^{21} |

5 | 536,870,912 | 2^{29} |

6 | 137,438,953,472 | 2^{37} |

7 | 35,184,372,088,832 | 2^{45} |

8 | 9,007,199,254,740,992 | 2^{53} |

When you are specifying
variable lengths, keep in mind
that variable length affects both the amount of memory used and the time required
for I/O and arithmetic operations. See
**SAS Language Reference: Dictionary** for more information on specifying
variable lengths.

If you know that a numeric variable will be between 0 and 100, you can use a length of 3 to store the number and thus save space in your data set. For example:

data mydata; length num 3; ...Numericmore SAS statements... run;

**CAUTION:****Use 3 bytes only for those variables with small values, preferably integers.**If the value of a variable becomes large or has many significant digits, you may lose precision in arithmetic calculations when the length of a variable is less than 8 bytes.

For more information on specifying variable lengths
and optimizing system performance, refer to
**SAS Language Reference: Concepts**.

Chapter Contents |
Previous |
Next |
Top of Page |

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