[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Too many decimal places for ODBC

From   "[email protected]" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: Too many decimal places for ODBC
Date   Tue, 13 May 2008 10:43:47 -0700

Hi statalisters,

I'm trying to establish ODBC-connections between Stata and a Firebird
database (V: 2.1) under Win XP.
The available ODBC-drivers are a bit outdated and not well documented. So I
had to find out more or less by trial and error why I couldn't export float
and double vars. The error is not a decimal point/comma issue but a issue of
decimal places.
The ODBC-driver is only capable of 18 decimal places while stata exports 20.

So what happens:
gen float age = 6
odbc insert age , table(s1) dsn(firebird) create sqlshow

** ...leads to:

INSERT INTO s1 (age) VALUES (6.00000000000000000000)
[ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -104 Token unknown - line 1, column 30 6


Cutting a value to 18 decimal places works:

odbc exec("insert into s1 (age) VALUES (6.123456789012345678)"),

** ...leads to:
insert into s1 (age) VALUES (6.123456789012345678)


My question:

Is there any way to reduce decimal places before ODBC export inside Stata (I
need no more than 2 or 3 decimal places)

There are workarounds (like export as string or export multiplied with 1000
as an integer - with reconversion inside the database) but these are
burdensome and error-prone in routine use.

Best wishes

Stefan Gawrich

*   For searches and help try:

Privileged, confidential or patient identifiable information may be contained in this message. This information is meant only for the use of the intended recipients. If you are not the intended recipient, or if the message has been addressed to you in error, do not read, disclose, reproduce, distribute, disseminate or otherwise use this transmission. Instead, please notify the sender by reply e-mail, and then destroy all copies of the message and any attachments.

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index