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

st: ODBC plus Excel column labels with a # sign


From   "Steichen, Thomas J." <SteichT@rjrt.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: ODBC plus Excel column labels with a # sign
Date   Tue, 25 Oct 2005 14:29:21 -0400

Listers,

I'm trying to load data into Stata from an Excel spreadsheet via ODBC.
I encounter a problem when some Excel columns are labeled with a pound 
sign # as part of the column label.  Stata kindly converts such to a 
default name:

    . odbc load, dsn("Temp PPXREF") table("ppxref$") lowercase clear
    subj# invalid name
     - converted subj# to var3
    appearance# invalid name
     - converted appearance# to var4

Here, subj# is renamed var3 and appearance# is renamed var4.

I'd rather, though, handle this as part of the load command so I tried to
use the variable renaming feature of load. This yields an error:

    . odbc load subjnum=subj# appearance=appearance#, ///
      dsn("Temp PPXREF") table("ppxref$") lowercase clear
    variable subj not found
     r(683);

The manual makes no mention of this issue so I tried every combination of 
quotes and escape characters that I could think of, but to no avail.

Does anyone know a solution for this as part of the load command?  

My current recourse is to use Stata's -rename- command after the load completes.

Tom

Thomas J. Steichen
steicht@rjrt.com
----------------------------------------------------------------------------
  Facts do not cease to exist because they are ignored. - Aldous Huxley
----------------------------------------------------------------------------


-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any attachment(s),
contains information that may be confidential, protected by the
attorney-client or other legal privileges, and/or proprietary non-
public information. If you are not an intended recipient of this
message or an authorized assistant to an intended recipient, please
notify the sender by replying to this message and then delete it from
your system. Use, dissemination, distribution, or reproduction of this
message and/or any of its attachments (if any) by unintended recipients
is not authorized and may be unlawful.


*
*   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