gretl - append within loop: Skipping non-existing files -
this question related to: import timeseries via loop (pot. generic)
i want import arbitrary number of files posited in same directory, not continuously labelled, e.g.: file_1,file_4,file_3001
i have small import script works consecutive files similar following:
scalar first = 1 #the first file file_1.tsv scalar last = 5000 #the last file base_path = "c:/results/file_" sprintf temp_path "%s%d.tsv",base_path,first open @temp_path --preserve setobs 1 1 --special-time-series loop (i=first+1;i<=last;i+=1) --quiet sprintf temp_path "%s%d",base_path,i append @temp_path endloop
now, when use on setting above (with missing files) error , script stops:
couldn't open ...
is possible somehow proceed / catch error , "continue" ?
i think "catch" command can need. take @ following code:
# creating files open australia.gdt store 0.gdt pau store 1.gdt pus store 2.gdt e store 4.gdt iau store 8.gdt ius store 10.gdt le # opening created files open 0.gdt loop = 1..10 catch append $i.gdt endloop
Comments
Post a Comment