BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have a macro that imports data from SQL using ODBC

proc sql noprint;
DROP TABLE tb_contas;
create table tb_contas
select * from SQLX.tb_contas;
quit;

this works well but I found a problem with big values

SQL table tb_contas there is a column x decimal(19.0)
on column x there is a value 844306657506657506

but when a search for that value on SAS tb_contas the result is the value 844306657506657536

I've been tried to create a table before that with format statemet (format=20.)
and execute a insert but the result is the same..

anybody know what is happen??

thanks

Vander
4 REPLIES 4
Doc_Duke
Rhodochrosite | Level 12
Vander,

You've got a problem with round-off errors. SAS stores numbers as real numbers, so there is a maximum integer size that it can exactly represent.

The maximum varies by platform, so you will need to go to the SAS documentation for your platform to look it up.

Doc
deleted_user
Not applicable
such wide integers need to be converted, either to character strings of appropriate length, or into two numeric variables. I expect the conversion needs to be completed on the data base platform, before ODBC tries to transfer the values.
deleted_user
Not applicable
Thank for the answers
deleted_user
Not applicable
I would second this, we have noticed that the same large integer number coming from two different ODBC sources; DB2 and SQL Server get scrambled up differently.

Highly suggest doing as Peter mentioned and convert at the base platform first!

Ike Eisenhauer Message was edited by: WDEisenhauer

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
  • 4 replies
  • 1346 views
  • 0 likes
  • 2 in conversation