Hi everyone. I'm a Stata beginner so I'm still new with macros. I'm trying to open, edit then save multiple files in the same folder. I've read similar posts and followed solutions about this particular topic but my code is not working. Specifically, in the folder "household2004", I have multiple files that start with "hh". When I ran the do file, I got the error "2. is not a valid command name r(199)".
clear
cd "...\household2004"
local files: dir . files "hh*.dta" //I checked by typing "display `files' and it showed me a list of the files I want to process
foreach f of local files {
2. use ` f ', clear
3. (editing)
4. save ` f ', replace
5. }
Thank you for your help
clear
cd "...\household2004"
local files: dir . files "hh*.dta" //I checked by typing "display `files' and it showed me a list of the files I want to process
foreach f of local files {
2. use ` f ', clear
3. (editing)
4. save ` f ', replace
5. }
Thank you for your help
Comment