On Wed, 20 Sep 2017, Schaff, Frederik wrote:
Many thanks! In the meantime I'll avoid names with "-".
PS: I
learned a lot from both scripts. :)
Glad to help. In fact I was wrong, the problem you found with Jack's
script was not to do with the identifiers, and after a further tweak
in git (and today's snapshots) it should work fine.
Also after recent tweaks your original idea of using "append"
will work -- on condition that you replace the label "ABMAT_ConfigID"
with "obs" (thus getting gretl to think of the values as observation
numbers). On *nix that could be done via
for f in *.tsv ; do
sed -i s/ABMAT_ConfigID/obs/ $f
done
Then the following (which borrows from Jack) will do the job:
<hansl>
set verbose off
string path_base = "" # or whatever
string path_ts = path_base ~ "parameters_"
string ts_name = ".tsv"
scalar first = 1
scalar last = 2 #1600
fname = sprintf("%s%d%s",path_ts,first,ts_name)
open @fname --preserve
loop i=first+1..last -q
fname = sprintf("%s%d%s",path_ts,i,ts_name)
append @fname --quiet
endloop
strings intervals =
defarray("0-499","500-999","1000-1499",\
"1500-1999","1500-1504","1500-1519","1500-1549",\
"1500-1599","1500-1749")
scalar n = nelem(intervals)
loop j=first..last --quiet
smpl j j
loop i=1..n --quiet
fname = sprintf("%sstat_%s_%d%s",path_base,intervals[i],j,ts_name)
append @fname --update-overlap
endloop
endloop
smpl full
varlist
print se_Seed sh_Seed MA_Utility_MAE_uq_I9 -o
</hansl>
On the relative merits of the different approaches: the matrix method
is fastest, but the join method is most "secure" in that it would
expose any inconsistencies in the input files. (All that the matrix
method checks is that the successive data files are of the right
overall dimensions to pack into place.)
Allin