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 <davee@ceu.ox.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: Cannot get date fields to import from PostgreSQL via ODBC
Date   Tue, 27 Sep 2005 10:32:49 +0100

-----BEGIN PGP SIGNED MESSAGE-----
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.
- -- 
Dave Ewart
davee@ceu.ox.ac.uk
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from http://www.ceu.ox.ac.uk/~davee/davee-ceu-ox-ac-uk.asc
N 51.7518, W 1.2016
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFDORHBbpQs/WlN43ARAhoTAJwIhAB+W+jbiKCzLZfrkZteAAQ1lACgsUUV
8ifnpWf4eiOhkhEbqXlI6Yw=
=PbJv
-----END PGP SIGNATURE-----
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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