Hi Statalist I have a question.
I have the following datasets: 2008_a8.txt, 2010_a4.txt, 2012_a7.txt, 2014_a5.txt, 2015_a2.txt and 2016_a3.txt.
A first part of my .do file generate the following version for each dataset: *_v2.txt, *_v3a.txt, *_v3d.txt and *_v4.txt.
Thus, if I do the following commands:
local files : dir "C:\Users\nf19281\Desktop\example" files "*.txt"
macro list _files
_files: "2008_a8.txt" "2008_a8_v2.txt" "2008_a8_v3a.txt" "2008_a8_v3b.txt" "2008_a8_v4.txt" "2010_a4.txt" "2010_a4_v2.txt" "2010_a4_v3a.txt" "2010_a4_v3b.txt" "2010_a4_v4.txt"
"2012_a7.txt" "2012_a7_v2.txt" "2012_a7_v3a.txt" "2012_a7_v3b.txt" "2012_a7_v4.txt" "2014_a5.txt" "2014_a5_v2.txt" "2014_a5_v3a.txt" "2014_a5_v3b.txt" "2014_a5_v4.txt"
"2015_a2.txt" "2015_a2_v2.txt" "2015_a2_v3a.txt" "2015_a2_v3b.txt" "2015_a2_v4.txt" "2016_a3.txt" "2016_a3_v2.txt" "2016_a3_v3a.txt" "2016_a3_v3b.txt" "2016_a3_v4.txt"
Actually, I need that my macro list considers only initial datasets.
How can I ask to Stata to consider only the original datasets?
I tryed with: local files : dir "C:\Users\nf19281\Desktop\example" files "*.txt" !="*v*.txt" but it doesn't work.
Thank you!
0 Response to How drop some elements from a macro list of files
Post a Comment