Statalist


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

Re: st: RE: RE: reading in multiple worksheet excel data


From   "Eva Poen" <eva.poen@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: RE: reading in multiple worksheet excel data
Date   Fri, 4 Jul 2008 12:38:25 +0100

Sachin,

I am not familiar with the .xlsx file format. However, if your data
are in .xls format, you could in principle acces the individual tables
via -odbc- from within Stata:

odbc load, dsn("Excel Files;DBQ=C:\MyFile.xls") table("Table1")

but I'm not sure this procedure translates to .xlsx.

As convenient as it may seem, I can only discourage anyone from this
approach. Excel does not have the concept of data type that applies to
the whole column (variable), i.e. you can have strings and numbers
mixed in an Excel column, and Excel will be perfectly happy with it.
Stata judges from the first few lines what the data type is for each
column. This can result in data loss if you have a string variable
that happens to have numbers in the first few lines.

Eva



2008/7/4 Sachin Chintawar <sachintalks@gmail.com>:
> Hi
> Has anyone ever tried importing files from .xlsx files. I tried using
> insheet but unfortunately it does not recognize the file extension.
> Considering that the file is very large it does not allow me to open in a
> Excel 2003 format. Also if I save my file in a text document that I am
> unable to import the variables that tend to be in more than one row.
> Any ideas would be greatly appreciated
> Thanks
> Sachin
>
> Sachin Chintawar
> Research Assistant
> Dept. of Agricultural Economics
> Louisiana State University
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Wallace, John
> Sent: Thursday, July 03, 2008 2:27 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: RE: reading in multiple worksheet excel data
>
> I would think the easiest thing to do would be to make an Excel macro
> that pages through the sheets and exports the active one to a text file.
> You could then switch to Stata and have a do-file read them in using
> insheet.
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Murali
> Kuchibhotla
> Sent: Thursday, July 03, 2008 11:19 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: reading in multiple worksheet excel data
>
>
>  Hello All,
>           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)?
>
> Sincerely,
> Murali Kuchibhotla
>
>
> *
> *   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/
> ------------------------------------------------------------
>
> This transmission is intended for the sole use of the individual
> and entity to whom it is addressed, and may contain information
> that is privileged, confidential and exempt from disclosure under
> applicable law. You are hereby notified that any use,
> dissemination, distribution or duplication of this transmission by
> someone other than the intended addressee or its designated agent
> is strictly prohibited. If you have received this transmission in
> error, please notify the sender immediately by reply to this
> transmission and delete it from your computer.
>
> *
> *   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/
>
*
*   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