It took me more than 10 minutes to figure out, so I’m posting this tip here.
I needed to loop over several files. Pseudocode would look like this:
global files a.csv b.csv c.csv
foreach file of global files {
….
}
Problem was that my filenames had spaces. I tried the following, but it didn’t quite work.
global files “a data.csv” “b data.csv” “c data.csv”
The solution that finally worked was to use Stata’s annoying double quotes:
global filelist `”"STOXX 600 1of3.csv” “STOXX 600 2of3.csv” “STOXX 600 3of3.csv”"‘
Note the extra `” and “‘ at the ends.