Thank you.


I wonder if changing the data format will make it easier – as I will have to teach students with limited ability.  I can't change the format much, but I could make it longer with each variable underneath each other and years as columns.  Is that what Gretl understands as stacked cross-sectional?


I did try the process in the manual, but I kept getting only one year of data when I put it into the panel structure





Alison Loddick


Learning Development Tutor (Mathematics and Statistics)

Library and Learning Services

DDI +44 (0)1604 893502

University of Northampton, Waterside Campus,

University Road, Northampton, NN1 5PH United Kingdom




From: Cottrell, Allin <>
Sent: 28 September 2022 17:46
To: Gretl list <>
Subject: [Gretl-users] Re: cross-sectional panel data


[CAUTION - EXTERNAL EMAIL] Please ensure you do not reply, click links, or open attachments unless you have verified the sender and know the content is safe.


On Wed, Sep 28, 2022 at 12:30 PM Cottrell, Allin <> wrote:
> You may or may not like this, but I'd say that the best way of handling the data you describe is to convert the dataset to a matrix, use gretl's matrix manipulation facilities to rearrange the data in stacked time-series form, then convert back to a dataset.
> Here's hansl code that does the job [...]

Oh, I forgot to say: There's a potential "gotcha" with this approach,
but it's easy to avoid. If the original data contain any missing
values, you should issue the command

set skip_missing off

before doing "matrix X0 = {dataset}". Otherwise the dimensions of X0
will not match the requirements of the subsequent code.

Gretl-users mailing list --
To unsubscribe send an email to

University of Northampton: Transforming Lives and Inspiring Change This e-mail is private and may be confidential and is for the intended recipient only. If you are not the intended recipient you are strictly prohibited from using, printing, copying, distributing or disseminating this e-mail or any information contained in it. We virus scan all E-mails leaving The University of Northampton but no warranty is given that this E-mail and any attachments are virus free. You should undertake your own virus checking. The right to monitor E-mail communications through our networks is reserved by us.


The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast, a leader in email security and cyber resilience. Mimecast integrates email defenses with brand protection, security awareness training, web security, compliance and other essential capabilities. Mimecast helps protect large and small organizations from malicious activity, human error and technology failure; and to lead the movement toward building a more resilient world. To find out more, visit our website.