Dear Statatlist,
I am using Stata 13 on a Windows 10 PC and have a number of data sets in a folder that I would like to append:
However, this doesn't work -- the word count of `filelist' is always one too many. Is there a reason for this?
Thanks for your consideration
Go
I am using Stata 13 on a Windows 10 PC and have a number of data sets in a folder that I would like to append:
Code:
cd "prepared data"
local filelist : dir . files "*.dta" // Create local with all filenames ending with ".dta"
di `filelist'
local first : word 1 of `filelist' // Identify first file
di "`first'"
local total_ : word count of `filelist' // Indentify total number of files
di `total_'
use "`first'", clear
forvalues x = 2/`total_' {
di "`x'"
local y : word `x' of `filelist'
append using "`y'"
}
Thanks for your consideration
Go

Comment