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
xtabond2 with p-value of AR(1) test > 0.1Dear All, In a typical application (xtabond2 to a dynamic panel data model), one often needs to chec…
New post-estimation command -suregr- available on SSC: calculates robust, or cluster robust variance post -sureg- estimation.Thanks to Kit Baum, I have made available on SSC a new post estimation command -suregr- (mnemonic fo…
Using reg or xtreg?Hi I'm new to STATA. Just completed a survey capturing about 3000+ responses from different city/pro…
Problem with renaming varsHi, I would like to rename a set of vars if they end with odd numbers and are between 1 and 42. The …
Difference interaction with country variable and multilevelHey, I'm about to examine how a two-way interaction differs depending on the country (I examine thre…
Subscribe to:
Post Comments (Atom)
0 Response to Run the same script over multiple .dta files via a loop
Post a Comment