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

Re: RE: st: Appending several excel data sets into one

From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: RE: st: Appending several excel data sets into one
Date   Mon, 17 Sep 2007 09:38:17 -0400

I think you miss the point. Many Stata users, myself included, receive data they need to analyze from others in Excel format -- sometimes in many separate xls files. These files often have data type (and format) issues -- at least when accessing them using default methods and the MS ODBC driver. I don't want to launch Excel, edit the raw datasets (running macros, etc), save my new versions and then import these files into Stata. Instead, I want to be able to work completely within Stata to get the data I need as it is provided in original format. By using an all-Stata approach, I can produce a single do file that performs an entire analysis -- from raw data to final results. This level of automation is critical to me so that I have a fully reproducible and documented analysis. Just because Excel CAN do something doesn't mean that's a good approach to take.

Michael Blasnik

p.s. it appears that you have a sticky "?" key on your keyboard :)

----- Original Message ----- From: "Sergiy Radyakin" <[email protected]>
To: <[email protected]>
Sent: Monday, September 17, 2007 8:52 AM
Subject: Re: RE: st: Appending several excel data sets into one

Excel does not provide a facility to access sheet names?????????
Download utilities????
What are we talking about?
Public Sub Liste()
<snip>> End Sub
This will create an index sheet in an arbitrary Excel file.
(No external utilities or black magic required).
Will probably work on every Excel version from the late 1980s or so...
Couple of lines can obviously be removed, but are left for clarity.

As for the types of variables, you can simply declare cells of having
cirtain type, e.g. numeric, or strings, or dates in exactly the same
way you will do it in any other system. Since Stata supports only two
types of variables, you do not see it very often explicitly, unless
you want to create a new variable. (oh, yes, yes, there are date
variables in Stata 10 too.)  However istead of directly specifiying
the type, you rely on the "The DaVinci Code of the Missings":

gen a = .
gen b = ""

so having seen this, any new-comer will be puzzled by the following line:

gen c = "."

What is the variable type? Is it assigned missing values ? How can I be sure?

Excel will do a good job as long as it is programmed to do it. Just
switch off all automatic "bells and whistles"  and tell it what you
want to do in a program (same as you do in Stata).

At least when it comes to programming, Excel is much superrior to
Stata with its Yeti-like macros found in no other interpreters aside

I have originally suggested to append the sheets in Excel, and after
following the responces with StatTransfer etc. still think it is not a
bad idea.

Best regards,
  Sergiy Radyakin
*   For searches and help try:

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