I am working with several csv. file each having a size between 700 MB to 2 GIG. I need to do some commands on each file and save them separately, otherwise the size would we even more huge and Stata crashes on my laptop, then I cannot see any results. So I look to append these results but I want to only save them in a single dta file. Here's is my code:
Code:
global path "E:/Comtradet1" cd "$path" foreach file of local datafiles { import delimited "`file'" , clear some commands save "$path/`file'.dta", replace }
Additionally, since this is also a problem of large data I would appreciate your suggestions about how to handle such a situation. The code works when I don't use a loop and simply import one csv file and do the commands on it and save it. But that's just too manual. I look for more automation and that's why I tried the loop above.
Looking forward to your solutions,
Shadi
0 Response to Working with large datasets, saving the dta files with different names in a loop
Post a Comment