Hi everyone,
I have written this code to import data into Stata (by already mentioning multiple datasets earlier):
foreach i of local surveybatch {
insheet using "$rawdata\survey_data\\`i'_e-survey.csv", comma names clear
keep v281 phone operator patientid survname calc_phone_number submissiondate postpaid
local k: subinstr local i "." "", all
tempfile `k'
save `k', replace
disp `k'
}
local surveybatch is already defined in the .do file. When it starts importing all the active datasets mentioned, Stata tells me that the file was not found. It just stops at the first dataset (even though when I open the Data Editor window, I see only the first dataset imported). Even when I reduce the number of datasets, it will always tell me that the first dataset was not found (even though that's the only dataset visible in the Data Editor). It doesn't move on to the other datasets at all. It tells me :
(note: file 20170901.dta not found)
file 20170901.dta could not be opened
Any one got any idea why this is happening? I have already checked my paths and made sure the files exist.
Really tired of trying to figure out the problem!
I have written this code to import data into Stata (by already mentioning multiple datasets earlier):
foreach i of local surveybatch {
insheet using "$rawdata\survey_data\\`i'_e-survey.csv", comma names clear
keep v281 phone operator patientid survname calc_phone_number submissiondate postpaid
local k: subinstr local i "." "", all
tempfile `k'
save `k', replace
disp `k'
}
local surveybatch is already defined in the .do file. When it starts importing all the active datasets mentioned, Stata tells me that the file was not found. It just stops at the first dataset (even though when I open the Data Editor window, I see only the first dataset imported). Even when I reduce the number of datasets, it will always tell me that the first dataset was not found (even though that's the only dataset visible in the Data Editor). It doesn't move on to the other datasets at all. It tells me :
(note: file 20170901.dta not found)
file 20170901.dta could not be opened
Any one got any idea why this is happening? I have already checked my paths and made sure the files exist.
Really tired of trying to figure out the problem!
Comment