I am looping over csv files in a directory, the names of which differ by two strings that i call `fed' and 'mask'. Not all filenames with these combinations exist, however. Following advice from previous forums, I initialised my loop by:
In this example, only the file "GER-MasksNo_concat.csv" exists, and it is the last called by the loop. The output is:
Why is it giving this error?
Code:
foreach fed in EUR GER {
foreach mask in Yes No {
local thisfile : dir "$datapath" file "`fed'-Masks`mask'_concat.csv"
if "`thisfile'" == "" {
di "`fed'-Masks`mask'_concat.csv does not exist. Skipping..."
}
else {
di "Processing `fed'-Masks`mask'_concat.csv..."
}
}
}
Code:
EUR-MasksYes_concat.csv does not exist. Skipping... EUR-MasksNo_concat.csv does not exist. Skipping... GER-MasksYes_concat.csv does not exist. Skipping... MasksNo_concat.csv"" invalid name

Comment