|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: Reading/Appending SEVERAL files using INSHEET
..Here's a basic approach, assuming that your files to insheet are all named
*.csv (otherwise change the local files command)
local i=0
cap erase mybigfile.dta
local files : dir . files "*.csv"
foreach f of local files {
drop _all
insheet using "`f'"
if `i'>0 append using mybigfile
save mybigfile, replace
local i=1
}
You may encounter problems if the insheet commands create some variables as
string for some files and numeric for others. This tends to happen more
than you might like and could require some additional code to check and fix
problems.
M Blasnik
----- Original Message -----
From: "John A Karikari" <[email protected]>
To: <[email protected]>
Sent: Friday, August 24, 2007 11:44 AM
Subject: st: Reading/Appending SEVERAL files using INSHEET
Can someone please show me how to read and append SEVERAL (over 500!)
files using "INSHEET"?
Thanks,
John Karikari
GAO
*
* 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/