Hi guys,
Thank you in advance for any advice any of you have. The problem I have encountered is running a loop to extract data from multiple excel files into 1 Stata file. The task I wish to complete is described below:
I have approximately 800 excel files in one folder in my computer. Each .xls file is a quarterly report for a specific bank in my dataset. The name of each file corresponds to the specific bank, year and quarter as follows: 'bank-name-year-quarter.xls'. From each file I need to extract 2 columns (the variable names in 1, and the values in the other). I also need to get stata to recognise the year and quarter from the file names in order to create a panel data set.
Ideally the panel data set would have the following structure in long form:
Bankname Year Quarter {variables 1-n}.
I am new to writing a loop for this purpose, and have not had much success in writing the appropriate code.
Hopefully someone has dealt with a similar issue before!
Regards,
Sascha
Thank you in advance for any advice any of you have. The problem I have encountered is running a loop to extract data from multiple excel files into 1 Stata file. The task I wish to complete is described below:
I have approximately 800 excel files in one folder in my computer. Each .xls file is a quarterly report for a specific bank in my dataset. The name of each file corresponds to the specific bank, year and quarter as follows: 'bank-name-year-quarter.xls'. From each file I need to extract 2 columns (the variable names in 1, and the values in the other). I also need to get stata to recognise the year and quarter from the file names in order to create a panel data set.
Ideally the panel data set would have the following structure in long form:
Bankname Year Quarter {variables 1-n}.
I am new to writing a loop for this purpose, and have not had much success in writing the appropriate code.
Hopefully someone has dealt with a similar issue before!
Regards,
Sascha
Comment