Statalist


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

Re: st: Appending several excel data sets into one


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: st: Appending several excel data sets into one
Date   Fri, 14 Sep 2007 08:18:07 -0400

...
A couple of additions to this list:

Option III: Use Stata's odbc commands within a loop

Option IV: Use Stat/transfer, which can be run from within Stata either within a loop or using it's batch facilities (I think).

M. Blasnik

----- Original Message ----- From: "Sergiy Radyakin" <[email protected]>
To: <[email protected]>
Sent: Friday, September 14, 2007 4:23 AM
Subject: Re: st: Appending several excel data sets into one



Option I
=====================================
1. Backup your data
2. Write a VBA script that will:
2a. set the sheet you need as active
2b. export the file in a CSV format (only the current sheet will be exported)
3. Cycle through your files calling the procedure in #2
4. Import the resulted CSV files in Stata and append

Option II
=====================================
1. Backup your data
2. Save everything as XML
3. Use -xmluse- in Stata, which provides options doctype(excel) and
sheet("sheetname")
4. Save and append (#3 and #4 in cycle)

Best regards,
Sergiy Radyakin

On 9/14/07, Patrick Musonda <[email protected]> wrote:

Dear Stata List,

I am working on a project where we get excel data that has several sheets,
for example:

data.xls-sheet1, sheet2, sheet3, etc
data.xls-sheet1, sheet2, sheet3, etc
data.xls-sheet1, sheet2, sheet3, etc
.
.
.
datan.xls-sheetn1, sheetn2, sheetn3, etc

We have several of such data sets, over n=200, say. Of these excel data
sets, we are only interested in one sheet, say sheet2. How can one append
these several sheet2s in one stata data sets in a simple program short of
coping one at a time and then appending them?
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index