How do I reference a data file with a macro?
问题 I have various Stata data files. These are located in different folders. I also have a single do file that uses these files, one at a time. Is there a way to use a macro to reference a particular dataset in my do file? For example: local datafile = "C:\filepath\mydata.dta" The idea is to use this later in the code as follows: use `datafile', clear Defining the macro as a global variable works. But I don't want to make it global, so it doesn't prevent me from running two separate programs at a