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?
Related Posts with importing multiple excel files using a loop
Ratio of male to female in a datasetHello. It's probably an easy question but I searched a lot and found nothing. I have a data set an…
melogit with crossed (non nested!) factors does not workDear all, thanks in advance. I have an issue that freaks me out. I wonder if I'm wrong to set up th…
Panel data and OLS assumptionsHi! Few days ago, there was an online webinar in my country in which the lecturers stated that many …
Integrating moderators in panel regressionDear all, I have a question about integrating moderators into a panel regression in Stata 14.2. Is …
Finding last day of the monthHello, I have the following code: Code: generate dayofmonth = day(date) rename (THENATIVE-ZWAHLENM…
Subscribe to:
Post Comments (Atom)
0 Response to importing multiple excel files using a loop
Post a Comment