Let me come back to yesterdays issue. I am trying to run the following
check whether variable "time" is in the list rxlist, or not. When time
is not part of the list, I obtain the error message "error evaluating
'if'". However, I think gretl should simply return a zero in this case.
Artur
<hansl>
function bundle foo (const list rxlist[null] "List of addit. regressors")
bundle b
rxlist
if !inlist(rxlist, rxlist.time)
printf "No time trend in rxlist!\n"
endif
if inlist(rxlist,rxlist.time)
rxlist -= rxlist.time
endif
rxlist
return b
end function
open denmark.gdt -q
genr time
# Case 1: const + time
list rxlist = const time
foo(rxlist)
# Case 2: const
list rxlist = const
foo(rxlist)
</hansl>
Am 01.12.2016 um 15:20 schrieb Sven Schreiber:
Am 01.12.2016 um 13:07 schrieb Artur T.:
>
> I want to get rid of the "time" variable from a list. This works fine
> out of a function but not within a function:
> y -= time
Inside a function you have to specify the list from which the series is
supposed to come. 'time' is no exception here:
y -= y.time
will work (have just tested it).
The exception is rather 'const', because your expression
y -= const
works although it's not given like 'y.const'. I guess the reason is that
const has special properties, always being present in the dataset,
having index 0 etc.
cheers,
sven
_______________________________________________
Gretl-devel mailing list
Gretl-devel(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-devel