Hi Leandro
I think that your best bet would be to use a relational database like MySQL to massage the
data into the format that you want. Then, once you have the data the way you want it you
could then export it as a CSV file and read that into gretl. I think that if you
structured a table in MySQL to mimic the format of your existing data, you could then run
a query and order by what ever the groupings that you want. For example, if you wanted
each block to be a supermarket, you would sort by the supermarket field. The SQL code for
such a query would look something like:
SELECT * FROM dset ORDER BY dset.supermarket;
where dset is whatever you name your table. You can also do aggregation with this if you
need to by using the GROUP BY function instead of ORDER BY.
-Neil
On 2010-04-03, at 10:00 AM, <gretl-users-request(a)lists.wfu.edu> wrote:
Send Gretl-users mailing list submissions to
gretl-users(a)lists.wfu.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.wfu.edu/mailman/listinfo/gretl-users
or, via email, send a message with subject or body 'help' to
gretl-users-request(a)lists.wfu.edu
You can reach the person managing the list at
gretl-users-owner(a)lists.wfu.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Gretl-users digest..."
Today's Topics:
1. Manipulating a database (Leandro Zipitria)
2. Re: Manipulating a database (Riccardo (Jack) Lucchetti)
From: Leandro Zipitria <leandro.zipitria(a)gmail.com>
Date: April 2, 2010 11:31:12 PM MDT
To: Gretl list <gretl-users(a)lists.wfu.edu>
Cc: Fernando Borraz <fborraz(a)gmail.com>
Subject: [Gretl-users] Manipulating a database
Reply-To: Gretl list <gretl-users(a)lists.wfu.edu>
Hello Gretl Community,
I have a database with daily prices which is in a rather unusual format and I want to
know if it is possibly to create a panel data with it using Gretl scripts. The database is
extracted from a dbf archive, and its has 6 variables:
- The (number of) supermarket from which the price is reported
- The (number of) the product which price is being reported
- The year of the price
- The month of the price
- The price reported itself
- The first day of the month the price is reported
- The last day of the month the price is reported
I have nearly one million rows with data, but in order to do some regressions -and use it
as a panel- I will need to transform it in a suitable way.
I suppose that the best way that Gretl can handle it is to create a specific column for
each product, and then stack all the supermarkets on a daily basis. In this way, I will
have each column representing a product, the first 700 rows being a price for each product
for supermarket 1, the next 700 rows being a price for each product for supermarket 2,
etc.
But in order to do it, I will need first to create the daily prices series, which is now
"compacted" in the datafile. I am attaching a random 10 elements from the
database in order to get a better picture of the situation. In the first sheet I submit
the actual data format, on the second one which I think should be the (best?) result.
I will first ask if this kind of transformation is possible in Gretl. I am aware that
running some scripts on other programs could do the trick, but I think that it could be
possible in Gretl to do it. But I am also think that it could be rather complex to do it,
and I am a new one on this issues.
Thank in advance.
Best regards,
Leandro ZipitrÃa
<gretl.xls>
From: "Riccardo (Jack) Lucchetti" <r.lucchetti(a)univpm.it>
Date: April 3, 2010 2:33:03 AM MDT
To: Gretl list <gretl-users(a)lists.wfu.edu>
Cc: Fernando Borraz <fborraz(a)gmail.com>
Subject: Re: [Gretl-users] Manipulating a database
Reply-To: r.lucchetti(a)univpm.it, Gretl list <gretl-users(a)lists.wfu.edu>
On Sat, 3 Apr 2010, Leandro Zipitria wrote:
> Hello Gretl Community,
> I have a database with daily prices which is in a rather unusual format and I want to
know if it is possibly to create a panel data with it using Gretl scripts. The database
is
> extracted from a dbf archive, and its has 6 variables:
> - The (number of) supermarket from which the price is reported
> - The (number of) the product which price is being reported
> - The year of the price
> - The month of the price
> - The price reported itself
> - The first day of the month the price is reported
> - The last day of the month the price is reported
> I have nearly one million rows with data, but in order to do some regressions -and
use it as a panel- I will need to transform it in a suitable way.
> I suppose that the best way that Gretl can handle it is to create a specific column
for each product, and then stack all the supermarkets on a daily basis. In this way, I
will
> have each column representing a product, the first 700 rows being a price for each
product for supermarket 1, the next 700 rows being a price for each product for
supermarket
> 2, etc.
> But in order to do it, I will need first to create the daily prices series, which is
now "compacted" in the datafile. I am attaching a random 10 elements from the
database in
> order to get a better picture of the situation. In the first sheet I submit the
actual data format, on the second one which I think should be the (best?) result.
> I will first ask if this kind of transformation is possible in Gretl. I am aware that
running some scripts on other programs could do the trick, but I think that it could be
> possible in Gretl to do it. But I am also think that it could be rather complex to do
it, and I am a new one on this issues.
Two remarks/suggestions:
1) Turning a dataset such as this into a panel dataset is not trivial from a _conceptual_
point of view: what are your units? supermarkets or products? or combinations of the two?
What would you use as the time unit (day, month, week)? If you choose anything longer than
a day (say, a week), how would you handle changes of prices during the week? Of course,
this is a design decision and gretl can't help you with this.
2) If you have your data in some database that can be queried via SQL, I think that our
ODBC apparatus may just fit your needs. You may want to have a look at the corresponding
chapter of the User's Guide.
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
=============================================
Neil Hepburn, Economics Instructor
Department of Social Sciences, Augustana Faculty
University of Alberta
4901-46 Avenue
Camrose, Alberta T4V 2R3
Phone (780) 679-1588
email nhepburn(a)ualberta.ca
No trees were harmed in creating this message. (However, millions of electrons were
terribly disturbed.)