Dear all,
I am trying to import a folder with .csv files to stata. Each file corresponds to a month of data, and they cover the period January 2013 to December 2020.
I am using the following code:
clear all
cd "${folder}"
local satafiles: dir . files "*.csv"
foreach file of local satafiles {
preserve
import delimited using "`file'", clear
save temp,replace
restore
append using temp
}
rm temp.dta
save "${folder}dataset", replace
clear all
However, I get the error "temp.dta not found".
Is there any typo/mistake in the code?
If someone could help, that would be great! Thanks!
Related Posts with Import a folder with .csv files
oaxaca: reference categoryDear Statalisters, I am using the Blinder-Oaxaca decomposition with the following code: Code: oa…
Test the effect that the combined level of education in couples has on financesHi Statalist. I would like to test the effect of the combined level of education of each partner in…
How can I count the observations by year (intervals) AND by country?Good day, So I have a data set (panel data) counting lots of variables. But for now I am only inter…
Code on Idiosyncratic SkewnessDear STATA Fraternity I am not good in writing codes. Somehow i tried to write a code for calculati…
calculating r square for a model estimated with multiply imputed data (mi estimate)Dear all, I would very much appreciate your help with calculating r-squared for models estimated wi…
Subscribe to:
Post Comments (Atom)
0 Response to Import a folder with .csv files
Post a Comment