I have a folder named "Data" with 8 xlsx files. These files are for 4 variables (PRICE, gRDEF, gRNDEF, gRINDP) and each variable has 2 files for different time periods and I want to combine these.
I am using the following code:
Code:
local vars `"price"' `"grdef"' `"grndef"' `"grindp"'
local sheets `"_period1"' `"_period2"'
foreach variable in `"`vars'"' {
local capvar = upper("`variable'")
}
foreach sheet in `"`sheets'"' {
import excel using "Data/`capvar'`sheet'.xlsx", firstrow case(lower) clear
}
However, when I run this code, the output shows file Data/.xlsx not found. ( I have set the working directory to be the folder in which "Data" is present.
Any suggestions?
0 Response to Importing multiple excel files
Post a Comment