Hi statalists, I have the following code but I always get the error message
local dpto AMAZONAS ANCASH APURIMAC
foreach x in local dpto {
import excel using "Z:\HigherEducation_Inequality\INEI\`x'_t.xls" , sheet(`x') clear
keep A B C
keep if A=="18"|A=="19"
xpose,clear
drop in 1
rename v1 pob18
rename v2 pob19
gen Name=`x'
gen id=_n
gen Year=1998 if id==1
replace Year=1999 if id==2
drop id
save data_`x',replace
}
file Z:/HigherEducation_Inequality/INEI`x'_t.xls not found
r(601);
Does anyone has any thoughts about what am I doing wrong?
0 Response to importing multiple excel files using a loop
Post a Comment