Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: --insheet--reading an excel file where row 1,2 are variable names and labels


From   Amanda Fu <mandy.fu1@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: --insheet--reading an excel file where row 1,2 are variable names and labels
Date   Thu, 23 Sep 2010 12:29:44 -0400

Dear Mr. Cox,

Thank you very much for your summary of the source and solutions for
these kinds of questions relating reading excel data using Stata. Now
I am quite clear.

Best wishes,
Amanda

On Thu, Sep 23, 2010 at 11:09 AM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> In essence, Stata, meaning -insheet-, doesn't know about your private convention of using your second row for extra information. That is, -insheet- works on the basis that at most the first line includes metadata, as is stated, or at least clearly implied, in the help. A corollary is that the second line is always treated as data, and -insheet- does not include options to override that.
>
> That could be regarded as a weakness of -insheet-, but the whole business is a slippery slope. For example, many people include extra blank lines in their worksheets, or add text annotations to certain cells, and so on, and so forth. The simplest and ultimately most practical line to take is that Stata is not MS Excel and does not purport to understand your spreadsheet data in the way that you do. Stata puts the responsibility on users to work out what management they need to undertake.
>
> See
>
> http://www.stata.com/support/faqs/data/newexcel.html
>
> for more context. On a personal note, my notional authorship of this FAQ does not signal any kind of expertise in MS Excel, a program I try to avoid to the maximum extent possible. Rather, people who use both MS Excel and Stata came to me with all sorts of little problems and in self-defence I started to work out and/or collate some solutions.
>
> In terms of your specific query, your alternatives include
>
> 1. Writing a program optimised for your specific spreadsheet conventions. That demands some programming skill and will only be a good idea if you have lots of such files.
>
> 2. Surgery in Stata, including use of -destring-, after import and looping over the values in observation 2 to define variable labels.
>
> 3. Use of some other import command.
>
> Nick
> n.j.cox@durham.ac.uk

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index