Hi,
I am trying to include the name of the file as a variable before appending. Please see code below, which works well.
ideally the variable should be created after importing the delimited file, but before saving as a dta file for all files to be appended
Thanks
clear
cd "C:\Users\aaaa"
local files: dir "C:\Users\aaaa" files "*.txt"
foreach file in `files' {
clear
import delimited `file'
save `file'.dta, replace
}
local files: dir "C:\Users\aaaa " files "*.dta"
foreach file in `files' {
append using `file'
}
Related Posts with Creating filename as columns in multiple files dta files before appending
brant can only be used after ologitHi everyone, Using brant subcommand, I am trying to test the parallel regression assumption. I am us…
Annual stock returnHey, I need your help. I need the follow variable "RETURN" in STATA. RETURN is the annual stock re…
help for line graphhi everyone, i have a data, see attachment, i want to get the line graph of variable BMI by differ…
Function to count categorical dataI have a database containing company names (company_name) and company countries of origin (company_o…
Is it possible to use two datasets at once?Hey STATA noob here, I'm wondering if it's possible to use variables from two different datasets at…
Subscribe to:
Post Comments (Atom)
0 Response to Creating filename as columns in multiple files dta files before appending
Post a Comment