turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- about the precision of a numeric variable in a dat...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-22-2010 11:42 AM

when I define a numeric variable (or attrib) in a dataset, since the variable would only have value in the range of 1-9000K, so I would like to define the length of variable to be 4 (bytes). based on rule in other database ststem, a 4 bytes integer should be able to handle max value of 2147483647. However, when try to insert a value greater than 2500k, it starts having the round off error, SAS does not complian the overflow (no warning or error) but just insert it with round off error.

I am trying to understand how sas stores the numeric value with different length and how to calculate the safe data range for a specified length? Also is there a way to add a check constrain to let SAS to spit an error when overflow happens?

I am new to SAS, any suggestion would be high appreciated.

I am trying to understand how sas stores the numeric value with different length and how to calculate the safe data range for a specified length? Also is there a way to add a check constrain to let SAS to spit an error when overflow happens?

I am new to SAS, any suggestion would be high appreciated.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-22-2010 12:32 PM

I don't know where you are getting your value of 2147483647 as the maximum integer value that could be stored precisely in 4 bytes. SAS documentation for both Windows and Unix environments indicates that the largest integer value which can be precisely stored in 4 bytes is 2097152, far smaller than 9000K=9000000. A 5 byte variable can precisely represent integer values through 536870912, so increasing your variable length by 1 byte would solve your problem here.

I would note that this question is much more about Base SAS than it is about SAS Statistical Procedures. In fact, I would say that there is really nothing in this post that has to do with Statistical Procedures. You would be likely to get a much better, more knowledgeable response if you posted your problem in the proper forum. Might I suggest the SAS Macro Facility, Data Step and SAS Language Elements forum.

I would note that this question is much more about Base SAS than it is about SAS Statistical Procedures. In fact, I would say that there is really nothing in this post that has to do with Statistical Procedures. You would be likely to get a much better, more knowledgeable response if you posted your problem in the proper forum. Might I suggest the SAS Macro Facility, Data Step and SAS Language Elements forum.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-22-2010 02:00 PM

Dale:

thank you. that value is from other programming language like fortran or c for a 4 bytes integer.

could you please send me the doc where you find the precisely stored value for 4 bytes? I could not find it in SAS help.

I did mean to post it in data step and sas langugae element forum but I was browsing each one and did not realize that I posted on the wrong forum. Thank you for the suggestion though.

thank you. that value is from other programming language like fortran or c for a 4 bytes integer.

could you please send me the doc where you find the precisely stored value for 4 bytes? I could not find it in SAS help.

I did mean to post it in data step and sas langugae element forum but I was browsing each one and did not realize that I posted on the wrong forum. Thank you for the suggestion though.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-22-2010 03:24 PM

Here is a link that gives the byte specification and maximum integer values on a Windows OS:

http://support.sas.com/onlinedoc/913/getDoc/en/hostwin.hlp/numvar.htm

http://support.sas.com/onlinedoc/913/getDoc/en/hostwin.hlp/numvar.htm