Hello,
I've an incredibly weird problem that I cannot wrap my head around. I am new to Stata, so could be a stupid error, but I can't find anything of help online, on the cd documentation, nor with AIs.
Anyways. I've defined local macros of directories to cut down on typing and increase readability. These macros work with commands such as import delimited and save. However, they do not work with cd. In that case, I get the error r(170).
Here's the code of relevance:
Why does cd send out r(170) when the directory clearly exists, is a directory, and is not protected? Or I assume that this is the case, since the local macro works with import delimited. Could it be due to the fact that I'm working in a cloud environment?
I've an incredibly weird problem that I cannot wrap my head around. I am new to Stata, so could be a stupid error, but I can't find anything of help online, on the cd documentation, nor with AIs.
Anyways. I've defined local macros of directories to cut down on typing and increase readability. These macros work with commands such as import delimited and save. However, they do not work with cd. In that case, I get the error r(170).
Here's the code of relevance:
Code:
clear cd local deso_populationdata_directory "/Users/theodorselimovic/Library/CloudStorage/OneDrive-Personal/Sciences Po/M2 Spring Courses/Advanced Panel Econometrics/Project/DeSo befolkning" foreach file of local mycsvfilelist { import delimited "`deso_populationdata_directory'/`file'", varnames(1) clear local outfile = subinstr("`file'",".csv","",.) save "`deso_populationdata_directory'/`outfile'", replace } cd deso_populationdata_directory
Why does cd send out r(170) when the directory clearly exists, is a directory, and is not protected? Or I assume that this is the case, since the local macro works with import delimited. Could it be due to the fact that I'm working in a cloud environment?
Comment