This is the overview of my project:
Main folder < subfolders < subfolders < excel files
Note: Over 500 xls files and a lot of Excel files have multiple tabs/sheets so want to capture that data also.
Problem: Stata runs the code for quite some time but then always gets stuck at this file. Is there a way we can know what file this is so I can go back to it and identify the source of why Stata doesn't append beyond this point.
Main folder < subfolders < subfolders < excel files
Note: Over 500 xls files and a lot of Excel files have multiple tabs/sheets so want to capture that data also.
- Convert from xls to dta
- In my final appended dataset I want to keep track of the excel file name that each observation came from. So somehow create a new variable FILENAME. As each file is converted, input the name of the excel file in the variable FILENAME for each observation in that file.
- Append all dta files (all excel files have identical variables)
Code:
xls2dta , clear generate(filename) recursive allsheets: append using ., importopts(allstring)
Comment