Dear Stata Users,
I compile a list of names of files in a directory:
(I believe I cannot escape using the foreach loop here because substr is not an extended macro function, right?)
This gives me a list of quarters like "2015Q4". Now, I am running into the following problems:
Thank you very much.[*] https://stackoverflow.com/questions/...macro-in-stata
I compile a list of names of files in a directory:
Code:
local filenames: dir "${datapth}" files "prefix_*_*.dta" foreach file of local filenames { local quarters `quarters' substr("`file'", strlen("`file'")-9,6) }
This gives me a list of quarters like "2015Q4". Now, I am running into the following problems:
- I want to delete duplicates in case, for example, "2015Q4" is contained more than once. This did not work:
Code:
local quarters: list uniq quarters
- From the resulting list of unique quarters, I may want to drop a certain quarter. This did not work:
Code:
local quarters: list quarters - "2015Q4"
Thank you very much.[*] https://stackoverflow.com/questions/...macro-in-stata
Comment