Thank you Michael and Nick. I will have a look at -fs- but first I
want to understand -subinstr-. I tried another way to strip "united
states 2002.dta" from the file list. However, when I pass this macro
to a loop I now get an error message because the macro "files2" still
contains three items, the last of which appears to be a blank.
. local files: dir . files "*.dta"
. di `files'
france 2002.dtagermany 2001.dtaunited states 2002.dta
. local files2: subinstr local files "united states 2002.dta" ""
. di `files2'
france 2002.dtagermany 2001.dta
. foreach file of local files2 {
2. di "`file'"
3. use "`file'", clear
4. }
france 2002.dta
germany 2001.dta
invalid file specification
r(198);
Notice the blank line before "invalid file specification". If I
switch the second and third lines of the -foreach- loop, the blank
line does not appear.
Friedrich Huebler
_______________________________
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now.
http://messenger.yahoo.com
*
* 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/