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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 718 views
  • 0 likes
  • 2 in conversation