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
Difference in PCA and PCA, factorHi everyone, I am created an asset index for my paper using Principle Components Analysis. I used t…
Count in how many districts two certain parties competeDear all, I am working on Data on election in Japan. I need to count in how many same distrcits the…
The matched sample of teffects nnmatchI am interested in obtaining the matched sample (observations in the treatment group that are matche…
Hausman test for negative binomial fixed effects and random effectsHello everybody! I am trying to model the relationship between the number of patents and oil prices…
"Prob > F" is larger than 0.5 for a single linear regressionArray I am writing a simple linear regression. Inventory data of products are dependent variable P…
Subscribe to:
Post Comments (Atom)
0 Response to Creating filename as columns in multiple files dta files before appending
Post a Comment