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.
P
Joseph Coveney wrote:
> 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:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* 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/