[Gretl-users] extracting month number

Annaert Jan jan.annaert at ua.ac.be
Mon Sep 17 01:45:05 EDT 2012


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 at univpm.it<mailto:r.lucchetti at univpm.it>>
Reply-To: "r.lucchetti at univpm.it<mailto:r.lucchetti at univpm.it>" <r.lucchetti at univpm.it<mailto:r.lucchetti at univpm.it>>, "gretl-users at lists.wfu.edu<mailto:gretl-users at lists.wfu.edu>" <gretl-users at lists.wfu.edu<mailto:gretl-users at lists.wfu.edu>>
Date: zondag 16 september 2012 22:40
To: "walt at dataanalyticscorp.com<mailto:walt at dataanalyticscorp.com>" <walt at dataanalyticscorp.com<mailto:walt at dataanalyticscorp.com>>, "gretl-users at lists.wfu.edu<mailto:gretl-users at lists.wfu.edu>" <gretl-users at lists.wfu.edu<mailto:gretl-users at 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 at univpm.it<mailto:r.lucchetti at univpm.it>
  http://www2.econ.univpm.it/servizi/hpp/lucchetti
--------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wfu.edu/pipermail/gretl-users/attachments/20120917/9c3de7e5/attachment.html 


More information about the Gretl-users mailing list