On Fri, 4 Dec 2015, Sven Schreiber wrote:
Hi again,
as you will notice, I am currently working on a real-life panel dataset,
and so here's another panel problem, with example; the following doesn't
work for me ("no obs would be left"):
Partly unrelated: surely priority number one is to fix buggy behaviour,
that's a given. However, having said this, I've found that for complex
scripting involving panel datasets the combined action of the aggregate()
and replace() function allows you to do amazing things.
For example, suppose that you wanted to create series with the pmean()
logic, but using the median instead of the mean: here's a nice way to do
it.
<hansl>
open abdata.gdt
list X = n w k
matrix M = aggregate(X, unit, median)
j = 3
loop foreach i X --quiet
$i_med = replace(unit, M[,1], M[,j++])
endloop
</hansl>
Which I personally find rather cool.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------