Tiago,
In addition to the other recommendations you can use the extended
macro functions for filenames and file paths. See -help extended_fcn-.
local filelist: dir . files "*.dta"
foreach file of local filelist {
use "`file'", clear
[other commands]
}
Friedrich
On Mon, Jul 13, 2009 at 7:36 AM, Tiago Dias<[email protected]> wrote:
> Hi, everybody. This is my first question to Statalist, so please excuse me if I commit a mistake.
>
> I have a directory with a few hundreds files, all in .dta. I need to -use- each one of them and make the same modification. If I modify one by one, I have a big chance of missing one of them or modifying twice a single file.
> I thought about using -dir- to get the filelist and -foreach- to have stata browsing, using, modifying and saving each file on filepath, but I don't know how to access the filenames in -dir-.
> Anyone has a idea?
>
> I'm using Stata 10.1 in Windows Vista.
*
* 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/