Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: Cannot get date fields to import from PostgreSQL via ODBC

From   Dave Ewart <>
Subject   Re: st: Re: Cannot get date fields to import from PostgreSQL via ODBC
Date   Tue, 27 Sep 2005 10:32:49 +0100

Hash: SHA1

On Monday, 26.09.2005 at 14:20 -0500, Kevin Crow - StataCorp wrote:

> You might want to try the -allstring- option of the -odbc load-
> command. 
> [snip details]

Ah, interesting: that certainly appears to work, in the sense that it
reads in the dates as strings.

However, this doesn't actually give you 'proper' date variables, does
it?  I realise one can string-splice to pull out the components of the
date, but that's rather tedious.  Also, it looks like -datestring- is a
better option than -allstring-, otherwise other numeric variables are
imported unnecessarily as strings (although there weren't any of those
in my example, there *are* in the 'real' database).

Regarding Stata versions: at the time I posted my original message, I
was running:

    Stata executable:  05 Jul 2005

    Ado-file updates:  05 Jul 2005

After running 'update all' etc., I get this:

    Stata executable:  15 Sep 2005

    Ado-file updates:  19 Sep 2005

There did not appear to be any odbc-related updates in the list of ADOs
that were downloaded.  In any case, the behaviour of the incorrectly
importing dates remains unchanged after testing again with the new,
updated version.

Can you suggest a way to 'transparently' import these dates as 'proper'
date variables?  Or at least a way to easily re-type the imported
strings as dates?

Thanks for your help so far, Kevin.

- -- 
Dave Ewart
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from
N 51.7518, W 1.2016
Version: GnuPG v1.2.4 (GNU/Linux)

*   For searches and help try:

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