My problem is that I need to change a directory before I save the files of an specific directory. I want to save the files in an output folder in another directory but if I change the directory inside the loop, it remains in the same directory
cd "$IN"
cd "C:\Users\...."
local myfile: dir "C:\Users\..." files "*.txt"
foreach file of local myfile {
di "`file'"
insheet using "`file'",clear
local outfile = subinstr("`file'",".txt"," ",.)
save "`file'.dta",replace
}
**
cd "$IN"
cd "C:\Users\...."
local myfile: dir "C:\Users\..." files "*.txt"
foreach file of local myfile {
di "`file'"
insheet using "`file'",clear
local outfile = subinstr("`file'",".txt"," ",.)
save "`file'.dta",replace
}
**
Comment