I am trying to import multiple files in csv format into Stata. Their names follow the format "variable_2010". I want to use a loop to import and save these files. I tried the following:
foreach var in varlist a b c d {
import "c:\`var'_2010.csv"
save ......
}
This does not work . The problem is that var is not recognised inside the path. How could I escape this problem?
varis here a local macro. People used to other languages may want to call it a variable, but it's not a variable to Stata, but, as said, a local macro.