Am 07.06.2022 um 18:28 schrieb Ioannis Venetis:
Hello all,
Hi Ioannis,
I attach two gdt panel data files (is what I managed to do, TIME is a
time index, GEO lists 38 countries/regions, and two variables CP00, CP01),
example1.gdt goes from 2016:01-2018:12 and
example2.gdt goes from 2019:01-2022:04
Actually it seems to be the other way around.
(A) is there an "easy" way to "join" the two gdt
files into one
time-larger file? running from 2016:01:-2022:04?
I think the trick here would be to first extend the time dimension of
the earlier dataset (example2) to cover everything up to 2022, being
empty until the actual appending is done. (menu Data/Add observations)
Simple appending still doesn't seem to work then (maybe it should), but
you can use the graphical join option, then in the dialog window specify
"TIME" and "GEO" as the keys to be matched. In the GUI right now you
have to do that separately for each variable, I'm afraid. (In a script
it's easier for multiple variables, but here you only have two.)
Hope that explanation was clear.
(B) how can i "easily" transform the panel dataset into a
time-series
set with 38 CP00 series, say EU_CP00, EA_CP00,... and 38 CP01
series, EU_CP01, EA_CP01,...?
Ah, that's a classic - well, I just mean that I've had this type of
problem myself. I don't think there's a super easy way. One solution is
to convert the stuff to a matrix, reshape that, and then reload it into
a clean time series dataset. The key is to know that gretl's panel
storage is as stacked time series, so a series becomes an NT,1 vector
(when missings are included). Something like:
<hansl>
set skip_missing off
matrix M00 = {CP00}
N = max($unit)
T = max($obsminor) # $obsminor is time in panels
M00 = mshape(M00, T, N)
</hansl>
And then you would perhaps store the matrix M00, prepare a time series
dataset of length T, and load M00 and turn it into your series
collection. (Perhaps using the mat2list function.)
HTH,
sven