On Wed, 21 May 2014, Sven Schreiber wrote:
Am 21.05.2014 16:35, schrieb Ignacio Diaz-Emparanza:
> On 21/05/14 16:15, Riccardo (Jack) Lucchetti wrote:
>> On Wed, 21 May 2014, Sven Schreiber wrote:
>>
>>> Agreed (well, maybe deprecated and undocumented would be enough...); but
>>> there should still be a script way of creating seasonal/periodic
>>> dummies, and currently there is no alternative, or is there?
>>
>> <hansl>
>> tmp = time % $pd
>> list DUMS = dummify(tmp)
>> </hansl>
>
> I prefer that the number of each dummy corresponds with the observation:
>
> tmp = (time-1)%$pd + 1
> list DUMS = dummify(tmp)
>
Aren't you assuming that the workfile/sample actually starts with the
"right" obs here?
Anyway, thanks for all your suggestions, but what I really meant was a
function (or command) that mirrors the menu entry like 'genr dummy'
does, not some clever way to code it...
At present we have 7 "specials" with the form "genr <name>", for
<name> =
dummy, timedum, unitdum, time, index, unit, weekday. I haven't checked
rigorously but I don't think "genr weekday" is documented (though there is
a documented weekday() function).
The "genr unit" special is shadowed by the accessor $unit. We could do the
same for "index" if that were thought worthwhile.
As for the ones that add several variables, I don't think a $-accessor
would work well. We _could_ have (e.g.) an accessor $dummy that adds a
bunch of series and returns a list but that would look a bit weird if you
didn't need to assign the list, having "$dummy" by itself on a line of
hansl. Maybe a function named "dummies" (that returns a list) with a
parameter to handle the panel cases (timedum, unitdum).
Allin