Hello, I am attempting to to call in different sheets of the same file using a loop with the code below, but I keep getting the error "{ required". Would someone please assist me with diagnosing and correcting the issue? Thank you in advanced!
local coordinator "Erica Frank John Ken Lee Loweye Sam Tyrone"
foreach x of local coordinator "Erica Frank John Ken Lee Loweye Sam Tyrone" {
import excel "C:\Users\rtorres43\OneDrive - NYCDOE\Documents\PSAL Data_Desktop\IAP Outstanding Assignments\IAP Outstanding Assignments 11-15-23.xlsx", sheet("`x'") firstrow case(lower) clear
keep if assignmentstatus=="Complete"
save "IAP_Assignments_`x'_11-15-23.dta", replace
}
local coordinator "Erica Frank John Ken Lee Loweye Sam Tyrone"
foreach x of local coordinator "Erica Frank John Ken Lee Loweye Sam Tyrone" {
import excel "C:\Users\rtorres43\OneDrive - NYCDOE\Documents\PSAL Data_Desktop\IAP Outstanding Assignments\IAP Outstanding Assignments 11-15-23.xlsx", sheet("`x'") firstrow case(lower) clear
keep if assignmentstatus=="Complete"
save "IAP_Assignments_`x'_11-15-23.dta", replace
}
Comment