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
A little help with summary statisticsHey everyone, Firstly happy Christmas to those who celebrate it and happy holidays too! Back to th…
New version of cprdhesutil on SSCThanks once again to Kit Baum, a new version of the cprdhesutil package is now downloadable from SSC…
Calculating person yearsHi everyone, I am analyzing mortality data from the National Health Interview Survey. The public us…
Change ID codes to a corresponding different ID codes in a panel datasetI have a dataset where the industries are identified with the NAIC codes. I want to change the NAIC …
Calculating duration of follow-up timeHi everyone, I am analyzing mortality data from the National Health Interview Survey. The public us…
Subscribe to:
Post Comments (Atom)
0 Response to Import a folder with .csv files
Post a Comment