Hello,
I have 10 network directories containing a number of .dta files. The data files, in each directory, all have the same name, so I can run the come code, pointing to each directory, without having to change the code. The only thing I need to change is the directory. The .dta files in each directory are the same in each folder, with the exception of a population.dta - this is different in each folder: It has a different population projection - but is in the same format as every other population.dta, and the same name. The directories follow the same naming convention , c:/drive/year1 c:/drive/year2 c:/drive/year3 etc.
At the moment I run the code separately, once for each directory, I just cancel out the directories I don't need each time.
I was wondering if there was a way to use a loop to do this, for example
local directories (list of directories)
foreach d of local directories {
}
However, I have not got further than the above!
There may be better ways of doing this work - but this is the structure I have inherited and would like to automate via a loop this bit of the work, as it can take several hours for the code to run through a directory at a time.
Related Posts with Loop same code through different directories
High R-square in ppmlDear Statalist community, I would like to clarify few things about using ppml on gravity data. 1. …
How to know whether the paralell trend assumption is satisfied by using the method of Borusyak, (2021) in DiD ?Hi all, I am following the method of Borusyak, (2021) by running the Code: did_imputation package. …
how to merge data using different key variable names?I want to merge data between variable1 in dataset1 and variable2, variable3, variable4 in dataset2 r…
-merge- not finding all matchesI'm running Stata version 14.2 on Windows. My analysis includes weight data for children. My main an…
How to compute constant on fixed effects Quantile regressionHi, I know that xtqreg command does not show any constant, however, as i am working on a genetics t…
Subscribe to:
Post Comments (Atom)
0 Response to Loop same code through different directories
Post a Comment