Am 21.05.2014 11:49, schrieb Riccardo (Jack) Lucchetti:
> On Wed, 21 May 2014, Sven Schreiber wrote:
> 
>> Next I would like to convert the workfile from 7-days-daily to
>> 5-days-daily, i.e. remove the empty (=missings) weekends obs, but this
>> doesn't seem to be easy to do. (Note that removing all missing obs is
>> not equivalent, because that also eliminates other holidays, which is
>> another topic. Also I know I could use 'join' together with the source
>> csv file to do that, but I think it should be easier than that, no?)
> 
> This should do what you want: not the most elegant approach, but IMO
> quite clear and general. The only thing I don't like very much is the
> necessity to go through a temporary file, which I find quite ugly.
> Allin, we talked a bit about the possibility of having a "forever"
> option to the smpl command, which would effectively eliminate certain
> rows from a dataset (so that operations like "keep" and "drop" in Stata)
> become quite easy. What do you think?

I'm not Allin, but also related to the issue of the other holidays in
the data, this would be helpful I think. I would guess that people
working with daily data (which I rarely do) treat the time series as
being equally spaced over time (=as a standard time series) even though
it is not, strictly speaking, due to the weekends and holidays. I mean
that's what gretl also does with its 5-day-daily and 6-day-daily formats.
But currently in gretl I'm always losing the time-series property of my
workfile when I remove the missing holidays, and so I could not use the
built-in time series tools. My workaround has been to save this as a
special time series workfile with periodicity 1, so no date information
anymore. But this feels like a cludge (for example no daily dummies,
except if I created them beforehand).

> 
> /*
>  trash weekends
> */
> 
> # first, construct a "weekend" dummy series
> 
> scalar y1 = $obsmajor[1]
> scalar m1 = $obsminor[1]
> scalar d1 = $obsmicro[1]
> scalar wd1 = weekday(y1, m1, d1)
> series wd = time + wd1 - 1
> series we = (wd%7)==6 || (wd%7)==0

Thanks Jack; I tried this more compactly with:
<hansl>
genr dummy # BTW, need a new syntax for this IMHO
series we = dummy_6 || dummy_7
</hansl>
but apparently the daily dummies are allocated "randomly", i.e. dummy_1
starts with whatever is the first obs in the workfile (or sample?), not
Monday or Sunday. Could this be changed perhaps?

thanks,
sven

Reply via email to