BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I execute the following in SAS 9.1:
proc sql;
create table work.test1(x int);
quit;

data work.test11;
length x 4;
set work.test1;
run;

proc sql;
insert into work.test11
values (20081101)
;
quit;
/* !! 20081101 --> 20081088 in work.test11 */

I have the unpleasant surprise to see that inserting the integer value 20081101 into a 4-byte numeric column changes the value to 20081088.

Is this a serious bug in SAS or am I doing something wrong?

Thanks in advance for help,
Chris
2 REPLIES 2
deleted_user
Not applicable
Thanks a lot for pointing that resource, urchin.
Until now , I thought that 4 bytes for numeric type in SAS can hold 32 bits of integer values, thus the limit (for signed integers) of around 2 billion for positive values.
Now I realize that SAS stores in a different way the numeric values and I also wonder if there is a way to have 4 bytes numeric size and still be able to hold 32 bits signed integers (in other words, is there a way to change the way SAS stores integers?).

Chris

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 971 views
  • 0 likes
  • 1 in conversation