Statalist


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

Re: st: reading in multiple worksheet excel data


From   "Joseph Coveney" <[email protected]>
To   "Statalist" <[email protected]>
Subject   Re: st: reading in multiple worksheet excel data
Date   Sat, 5 Jul 2008 13:42:37 +0900

E. Paul Wileyto wrote:

I use ODBC to move data from Excel to Stata a lot.  The detail left out
here is that you will need to define your ODBC source.  Windows has an
ODBC administrator that will do this for you painlessly.

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

You do need to add the Excel data source to the roster of drivers in the
User DSN tab (Data Sources icon in Windows Control Panel).  But you don't
actually need to configure it.

You can tell whether the driver has been added by typing

odbc list

from within Stata.  If the Excel data source is already added, then you'll
see something like

Data Source Name                   Driver
-------------------------------------------------------------------------------
Excel Files                        Microsoft Excel Driver (*.xls)

among the others listed in the Results window.  (Excel 2003 and Excel 2007
will show additional file extensions.)

Once the generic data source has been added, you can flexibly query multiple
Excel workbooks (files) from Stata anytime afterward just by putting
connection string information into the -dsn()- option of -odbc-.  The
connection string will need the DSN, DBQ and DefaultDir information.  The
DefaultDir information may be combined with the file name in the DBQ
argument, as Eva Poen showed recently in this thread.

Joseph Coveney


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