Help using Base SAS procedures

Problem with importing data

Posts: 0

Problem with importing data

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;

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


Trusted Advisor
Posts: 2,113

Re: Problem with importing data


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.

Posts: 0

Re: Problem with importing data

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.
Posts: 0

Re: Problem with importing data

Thank for the answers
Posts: 0

Re: Problem with importing data

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
Ask a Question
Discussion stats
  • 4 replies
  • 2 in conversation