My data is in .xls format with multiple worksheets. The worksheets are named by month, for e.g january, february, march, etc. I want to:
1. convert each worksheet into a dta file and then append each file individually
2. name the saved file with the last "_*" from the file name. So in the example below, the final, appended dta file will be "KAR".
However, my code below fails to do so. Any help will be much appreciated
1. convert each worksheet into a dta file and then append each file individually
2. name the saved file with the last "_*" from the file name. So in the example below, the final, appended dta file will be "KAR".
However, my code below fails to do so. Any help will be much appreciated
Code:
local mylist january february march april may june july august september october november december foreach x in local `mylist' { import excel using "${db}\raw data\OCEmr_Jan to Dec2022_KAR.xlsx", sheet("x") firstrow case(lower) clear save "Originaldata", replace }
Comment