Dear Allin,
Oh, Thanks. This was because I did not know the "obslabel()" function
exists. I agree with you what you demostrated is quite
straightforward. Thanks again for your instant response.
Yi-Nung
2009/11/23 Allin Cottrell <cottrell(a)wfu.edu>:
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
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users