On Sun, 15 Jun 2014, Allin Cottrell wrote:
On Sun, 15 Jun 2014, Riccardo (Jack) Lucchetti wrote:
> On Fri, 13 Jun 2014, Allin Cottrell wrote:
>
>> I'm adding below a script that creates a period ID using these
>> variables. Perhaps it ought to be possible to do this more easily --
>> and maybe in fact it is (Jack?) but anyway it's something of a
>> showcase for gretl's current string-handling capabilities.
>
> Would it be possible to post to the list at least a subset of John's data,
> so can the audience can try a few things out? ;)
There's now a copy at
http://ricardo.ecn.wfu.edu/~cottrell/tmp/paravantis.txt.xz
Thanks.
In case someone wants to play with it a little, I'm, attaching a sample
script (to be run against current CVS), which adds very little to Allin's
previous script: the only thing is, we use "join" to pull series in one by
one, so we avoid reading the whole file into memory at once, which could
have been a problem if the file had been truly enormous (as opposed to
quite big!!!).
<hansl>
nulldata 243814 # assume this is known, but shouldn't be difficult
join paravantis.txt HOUSENUM
join paravantis.txt DAY
join paravantis.txt TIME
# append any other variable you may need, eg
loop foreach i INCOME UNEMPLOYED FUELPOV2012
join paravantis.txt $i
endloop
# now construct the "half-hour" series
series hh = NA
scalar x1 x2
loop i=1..$nobs --quiet
sscanf(TIME[i], "%d:%d", x1, x2)
hh[i] = x1*2 + (x2==30)
endloop
series truetime = DAY*48 + hh
setobs HOUSENUM truetime --panel-vars
</hansl>
-------------------------------------------------------
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
-------------------------------------------------------