On Mon, 23 Nov 2009, yinung at Gmail wrote:
It would be great if we can have a weeksay fundtion working for
(irregular) daily data as follows
series wkDummy1 = weekday()
In my opinion that's too specialized a task for a built-in
function. But it's now very easy with the weekday() and
obslabel() functions:
<script>
open djclose.gdt
scalar T = $nobs
scalar yr, mo, day
series monday = 0
set messages off
loop i=1..T -q
string date = obslabel(i)
sscanf date, "%d/%d/%d", &yr, &mo, &day
if weekday(yr, mo, day) == 1
monday[i] = 1
endif
endloop
print djclose monday -o
</script>
Allin Cottrell