Help using Base SAS procedures

Problem with importing data

Reply
N/A
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;
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
Trusted Advisor
Posts: 2,113

Re: Problem with importing data

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

Re: Problem with importing data

Thank for the answers
N/A
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
  • 132 views
  • 0 likes
  • 2 in conversation