I am trying to import multiple CSV files in a foreach loop. I saved the filenames in the local named "files". All the files are located in a subfolder called "data".
Code:
tempfile master save `master', replace empty local files "1_Post_Chernobyl_survey_data_radiocaesium_in_soil_vegetation_wildlife_1986_and_1987.csv" /// "2_Post_Chernobyl_survey_data_radiocaesium_in_vegetation_1986_1987_1988.csv" /// "3_Post_Chernobyl_survey_data_radiocaesium_in_soil_and_vegetation_1989_and_1990.csv" /// "4_Post_Chernobyl_survey_data_radiocaesium_in_soil_and_vegetation_1992.csv" /// "5_Post_Chernobyl_survey_data_radiocaesium_in_fungi_1994_to_1997.csv" foreach file of local files { import delimited "data/`file'", asfloat /// case(lower) /// delimiters(",") /// encoding("utf-8") /// stripquotes(yes) /// clear append using `master' save `master', replace }
0 Response to Import multiple CSV files
Post a Comment