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
How to assess if there is enough variation in your dependent variableIs there a simple way to assess if there is enough variation in your dependent variable, or is it be…
xtivreg , first failes with "conformability error" r(503)Dear Readers xtivreg without "first" runs fine, but fails when I add the "first" option with "confo…
Change in variance time seriesHi everyone, I am analysing a time series (stock returns) and I am trying to check whether variance…
Split String Code: clear input HAVE WANT1 WANT2 AA01 AA 01 AZ02 AZ 02 AV03 AV 03 AA04 AA 0…
New version of wridit on SSCThanks as always to Kit Baum, a new version of the wridit package is now available for download from…
Subscribe to:
Post Comments (Atom)
0 Response to Import a folder with .csv files
Post a Comment