Hi,
I have around 30000 files located in different folders. The name of each folder is the name of a country. I would like Stata to pick all the files contained in each of the 27 folders and append them into one dataset. All the files have "1_201" at the beginning of the name, so I have tried the following:
cd "\\s-jrcsvqfs007p\Data_BigRepo\JRC.J.3\Estrella\itunes_ eu_us\time_series\data_eu"
foreach x in at be bg cy cz de dk ee es fi fr gr hu ie it lt lu lv mt nl pl pt se si sk gb us {
forv y=30828/41217{
preserve
insheet using "TopMovies\`x'\1_201`y'.txt", delimiter ("|") clear
save tmp, replace
restore
append using tmp
}
}
but I obtain the following error message:
"file TopMovies`x'\1_20130828.txt not found"
It seems I cannot use the name of the folder in the loop. Another problem is that all the files contained in the different folders have the same name (which is actually a date), so I cannot put all the files into one single folder
Any idea?
Thank you,
Estrella Gomez
I have around 30000 files located in different folders. The name of each folder is the name of a country. I would like Stata to pick all the files contained in each of the 27 folders and append them into one dataset. All the files have "1_201" at the beginning of the name, so I have tried the following:
cd "\\s-jrcsvqfs007p\Data_BigRepo\JRC.J.3\Estrella\itunes_ eu_us\time_series\data_eu"
foreach x in at be bg cy cz de dk ee es fi fr gr hu ie it lt lu lv mt nl pl pt se si sk gb us {
forv y=30828/41217{
preserve
insheet using "TopMovies\`x'\1_201`y'.txt", delimiter ("|") clear
save tmp, replace
restore
append using tmp
}
}
but I obtain the following error message:
"file TopMovies`x'\1_20130828.txt not found"
It seems I cannot use the name of the folder in the loop. Another problem is that all the files contained in the different folders have the same name (which is actually a date), so I cannot put all the files into one single folder
Any idea?
Thank you,
Estrella Gomez
Comment