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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: import excel data into STATA


From   Neil Shephard <nshephard@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: import excel data into STATA
Date   Fri, 15 Oct 2010 08:21:41 +0000

On Fri, Oct 15, 2010 at 5:35 AM, Kay Walker <kay.walker@internode.on.net> wrote:
>
> Hi samn,
>
> You should try to import the columns with text data separately from the
> rest.
> Set up the columns in Stata  ready to receive text, then simply copy and
> paste the text data into the new file.

This is a bad idea in my opinion.

1) Splitting data is pointless, it will (presumably) need to be
recombined again, you're making more work for yourself in splitting
data.

2) Copying and pasting into the data editor is slow, laborious and not
conducive to automation (i.e. scripting in a do-file).  Next time the
data needs to be imported into Stata because the underlying data set
has changed you can't just run a script.

On Fri, Oct 15, 2010 at 12:38 AM, sun samn <shwshang@hotmail.com> wrote:
>
>
> Hi, there,
>    I use 'odbc load' to import excel data. It works fine for double  variables(numbers), but not for string variable(letters). Basically when the variable is string, the observation is zero.
>

My experience of using -odbc-load- is to query databases.  I've never
used it to import M$-Excel files.

You don't tell us the _exact_ command you are using and the output
that Stata produces so its difficult for anyone to start trying to
work out why things aren't working as you expect them to.

My advice would be to save the M$-Excel file as an ASCII
comma-separated variable (*.csv) file and to then use -insheet- to
read the data into Stata.

Another alternative is to use StatTransfer to convert the M$-Excel
file to a Stata data file (see http://www.stattransfer.com/)

Neil


-- 
"Our civilization would be pitifully immature without the intellectual
revolution led by Darwin" - Motoo Kimura, The Neutral Theory of
Molecular Evolution

Email - nshephard@gmail.com
Website - http://kimura-no-ip.org/
Photos - http://www.flickr.com/photos/slackline/

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