I have large table of 59 million observations across over 400 variables. These have been split the table into 10 .dta tables, each beginning with the word q10. There is some processing to be done on each of the 10 files, and I have created a .do file to do this. I wanted to write some code so that the processing would be automatic, in that, the .do would read in each of the q10* files, process, save,replace and the read in the next q10* file. I have some code that I thought would work:
local workdir "x:\xxxx\xxxa\xx"
cd: `workdir'
local files: dir "`workdir'" files "q10*.dta"
foreach `files' of local files {
processing script
save `files', replace
}
However, I get the following error:
invalid syntax
after cd:`workdir' and I am not sure, if this is the best approach as I am fairly new to using loops and have not had to do this amount of processing before. Can anyone help with the approach to take and/or how to amend the above script?
Related Posts with Run the same script over multiple .dta files via a loop
Coding the competitive(close) election in U.S. state legistlation electionsIt is my first time writing a post in the forum, so I am not sure I can use dataex. As a result, I p…
How to create a dummy age for 165 people for 20 yearsDear All I wanted to ask how we can create a dummy age and date of appointment for 170 people for 2…
How can I check if two string variables contain any same elements?Hi all, I have a question about comparing two string variables. I wanted to compare the values of t…
psmatch2 and teffects psmatchI have a question, how can I get the pscore delivered by psmatch2 command automatically, but using t…
mixed: How do I retrieve the intercept-slope correlation?Hi I am fitting a model like this: Code: webuse nlswork, clear mixed ln_w tenure || id: tenure, …
Subscribe to:
Post Comments (Atom)
0 Response to Run the same script over multiple .dta files via a loop
Post a Comment