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

Re: st: reading in multiple worksheet excel data

From   "Joseph Coveney" <>
To   "Statalist" <>
Subject   Re: st: reading in multiple worksheet excel data
Date   Fri, 4 Jul 2008 10:11:06 +0900

Murali Kuchibhotla wrote:

I often work with excel files comprising of multiple worksheets. Is
there a simple way to read into Stata a single sheet from such a file
(something that mimics the insheet command for single sheet excel files)?


You can do this via ODBC.  The command would look something like

odbc load, table(...) dsn(...)

where the argument for the -table()- option would contain the name of
worksheet.  See the documentation and online help file for -odbc- for
details.  (If your worksheet has any columns containing a mix of numeric and
character data, then you'll need to use a workaround when reading them via
ODBC.  The workaround has been posted on Statalist a few times over the past
few years, and should be readily locatable in the archives.)

If you have Stat/Transfer licensed, then you can use that directly from
Stata via Roger Newson's -stcmd- package, which is installed when you
install Stat/Transfer.  See the help file for -stcmd- for details.
Stat/Transfer will automatically detect and accommodate mixed data types in
a worksheet column.

Joseph Coveney

*   For searches and help try:

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