Chapter Contents |
Previous |
Next |

SAS Companion for the OS/2 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 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.

Length in Bytes |
Largest Integer Represented Exactly |
Exponential Notation |
---|---|---|

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} |

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.

**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.

Chapter Contents |
Previous |
Next |
Top of Page |

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