I am trying to automate the importing process of 300 Excel files into Stata.
The files represent a time of 25 years, with each month represented in one file. The files contain the same number and type of variables (i.e. all are string variables).
I would appreciate any tips. The string variables are as follows:
unemp_rate gdp gini year
11 .02 22 2002
22 2 30 2003
My code is below:
clear all
ssc install xls2dta
xls2dta, save("C:UsersxyzOneDrive - xyzDocumentsxyzxyz") : import excel "C:Usersxyzxyz- xyzDocumentsxyzxyz"
xls2dta, save ("C:Usersxyzxyz- xyzDocumentsxyzxyz") : append, force
use "C:Usersxyzxyz- xyzDocumentsxyzxyz2xyz.dta", clear
However, the variables have been imported as A,B,C, D, etc... rather than the actual variable names above.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…