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