Actual I am trying to force quarterly data into monthly data set (I want to leave missing
observations). This works
nulldata 8
setobs 4 2012:01
string frequency = "q"
join "gretl_tmp_3785.csv" out --tkey="obs,%Y@frequency%@frequency"
--aggr="avg" --data="ENU2705340010"
but this does not
nulldata 24
setobs 12 2012:01
string frequency = "q"
join "gretl_tmp_3785.csv" out --tkey="obs,%Y@frequency%@frequency"
--aggr="avg" --data="ENU2705340010"
So I am making a silly mistake.
Thanks
Logan
-----Original Message-----
From: gretl-users-bounces(a)lists.wfu.edu [mailto:gretl-users-
bounces(a)lists.wfu.edu] On Behalf Of Allin Cottrell
Sent: Monday, December 08, 2014 7:51 PM
To: Gretl list
Subject: Re: [Gretl-users] Question about join
On Mon, 8 Dec 2014, Allin Cottrell wrote:
> On Tue, 9 Dec 2014, Logan Kelly wrote:
>
>> Thanks Allin, here is an example:
>>
>> string frequency = "q"
>> #join "gretl_tmp_3785.csv" out --
tkey="obs,%Y@frequency%@frequency"
>> --aggr="avg" --data="ENU2705340010"
>> join "gretl_tmp_3785.csv" out --tkey="obs,%Yq%q"
--aggr="avg"
>> --data="ENU2705340010"
>>
>> Both join commands yields the same error. Attached is the csv file
>> (also pasted below).
>>
>> obs, ENU2705340010
>> 2013q4, 1209
>> 2013q3, 1163
>> 2013q2, 1142
>> 2013q1, 1276
>> 2012q4, 1239
>> 2012q3, 1135
>> 2012q2, 1123
>> 2012q1, 1278
>
> Thanks, Logan. Now what does the "inner" dataset look like before you
> try the join? For comparison, here's an example I just tried:
> I open data9-7.gdt (quarterly data 1975:1 to 1990:4) and then I try
> using join on the following data file, named "import.csv":
>
> obs x
> 1980q1 1
> 1980q2 2
>
> using this script:
>
> <hansl>
> open data9-7.gdt
> join import.csv x --tkey="obs,%Yq%q"
> print QNC x -o
> </hansl>
>
> This works as expected, showing values 1 and 2 for "x" in quarters
> 1980:1 and 1980:2 respectively.
OK, I think I can guess what's happening. You're using the option --aggr=avg
so I suppose you're trying to average quarterly data into an annual dataset.
That won't work at present via join unless you have an annual key variable. I'll
have to think about that (and I admit, the error message you saw is
misleading). But in the meantime the following works.
My source file, import2.csv:
year quarter x
1980 1 1
1980 2 2
1980 3 3
1980 4 4
My script:
<hansl>
open data3-6.gdt # annual data
join import2.csv x --tkey="year" --aggr=avg print Ct x -o </hansl>
Allin
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users