Very compact, as always. But it wouldn't work for a dataset with weekly or daily frequency, would it? Jan Annaert UNIVERSITEITANTWERPEN | Faculty of Applied Economics (TEW) | Dept. Accounting & Finance Room S.B.335 | Prinsstraat 13 | B-2000 Antwerp | Belgium Phone +32 32654163 |Fax +32 32654064 http://www.ua.ac.be/jan.annaert http://ssrn.com/author=143473
From: "Riccardo Lucchetti (Jack)" <r.lucchetti(a)univpm.it<mailto:r.lucchetti(a)univpm.it>> Reply-To: "r.lucchetti(a)univpm.it<mailto:r.lucchetti(a)univpm.it>" <r.lucchetti(a)univpm.it<mailto:r.lucchetti(a)univpm.it>>, "gretl-users(a)lists.wfu.edu<mailto:gretl-users(a)lists.wfu.edu>" <gretl-users(a)lists.wfu.edu<mailto:gretl-users(a)lists.wfu.edu>> List-Post: gretl-users@gretlml.univpm.it Date: zondag 16 september 2012 22:40 To: "walt(a)dataanalyticscorp.com<mailto:walt(a)dataanalyticscorp.com>" <walt(a)dataanalyticscorp.com<mailto:walt(a)dataanalyticscorp.com>>, "gretl-users(a)lists.wfu.edu<mailto:gretl-users(a)lists.wfu.edu>" <gretl-users(a)lists.wfu.edu<mailto:gretl-users(a)lists.wfu.edu>> Subject: Re: [Gretl-users] extracting month number On Sun, 16 Sep 2012, Data Analytics Corp. wrote: Hi, I have a monthly time series of the Dow Jones Industrial Index beginning 1928:10. I'd like to create a new variable that is just the month number: 10, 11, 12, 1, 2, 3,.... How can I do this? I thought there would be a month function in Gretl, but I don't see one. This question, of course, extends to the year (1928, 1928, 1929, 1929,...) and quarter if I have quarterly data. Does this help? <hansl> open bjg.gdt series year = 1949 + floor((t-1)/12) series month = 1 + ((t-1)%12) </hansl> -------------------------------------------------- Riccardo (Jack) Lucchetti Dipartimento di Economia Università Politecnica delle Marche (formerly known as Università di Ancona) r.lucchetti(a)univpm.it<mailto:r.lucchetti(a)univpm.it> http://www2.econ.univpm.it/servizi/hpp/lucchetti --------------------------------------------------
Very compact, as always. But it wouldn't work for a dataset with weekly or daily frequency, would it?
Jan Annaert
UNIVERSITEITANTWERPEN
| Faculty of Applied Economics (TEW) | Dept. Accounting & Finance
http://www.ua.ac.be/jan.annaert
From: "Riccardo Lucchetti (Jack)" <r.lucche...@univpm.it>
Reply-To: "r.lucche...@univpm.it" <r.lucche...@univpm.it>, "gretl-us...@lists.wfu.edu" <gretl-us...@lists.wfu.edu> Date: zondag 16 september 2012 22:40 To: "w...@dataanalyticscorp.com" <w...@dataanalyticscorp.com>, "gretl-us...@lists.wfu.edu" <gretl-us...@lists.wfu.edu> Subject: Re: [Gretl-users] extracting month number On Sun, 16 Sep 2012, Data Analytics Corp. wrote:
Does this help?
<hansl>
open bjg.gdt
series year = 1949 + floor((t-1)/12)
series month = 1 + ((t-1)%12)
</hansl>
--------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
(formerly known as Università di Ancona)
--------------------------------------------------
|