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

Re: st: Re: ODBC plus Excel column labels with a # sign


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: Re: ODBC plus Excel column labels with a # sign
Date   Wed, 26 Oct 2005 11:07:27 +0900

Kevin Turner wrote:

[excerpted]

You might be able to import them via a SQL convert/rename, but I haven't had
any luck with the Excel ODBC driver supporting such syntax. Your best option
may be to use -rename- until the next update.

--------------------------------------------------------------------------------

You can enclose in square brackets column names and table names containing
nonstandard characters.  For example, the following works with an Excel
spreadsheet containing the data below, which mimic what Tom describes.

odbc load , ///
 exec("SELECT [subj#] AS subj, string_data FROM [Sheet1$]") ///
 dsn(Book1)

(By the way, I cannot get -allstring- to fix the problem Tom describes with
the second column.  It still loads the second column as double-precision
numeric.  Increasing the rows-to-scan setting in the ODBC configuration to
its maximum of 16 doesn't work, either.  Stata 9.1, Windows XP Professional
SP2, Excel 2000)

Joseph Coveney


Contents of Book1.xls, Sheet1:


subj#            string_data

1            1234567.8

2            1234567.8

3            1234567.8

4            1234567.8

5            1234567.8

6            1234567.8

7            1234567.8

8            1234567.8

9            1234567.8

10            1234567.8

11            1234567.8

12            1234567.8

13            1234567.8

14            1234567.8

15            1234567.t9

16            1234567.8

17            1234567.8

18            1234567.8

19            1234567.8

20            1234567.t9

21            1234567.8

22            1234567.8

23            1234567.8

24            1234567.8

25            1234567.8



*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index